Question: Consider the following code: num_widgets = 0 while True: choice = input(Would you like to buy a widget? (y/n): ) if choice.lower() == y: num_widgets
Consider the following code:
num_widgets = 0 while True: choice = input("Would you like to buy a widget? (y/n): ") if choice.lower() == "y": num_widgets += 1 else: break print("You bought", num_widgets , "widget(s).")
If the user enters Y at the prompt, what does the program print to the console?
A. You bought 0 widget(s) today.
B. You bought 1 widget(s) today.
C. You bought Y widget(s) today.
D. Nothing, the break statement will cause the program to end
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
