id=-996471 se id- 115055 1&content; id--3195209 1&question; n... Question 9 Aski
ID: 3905216 • Letter: I
Question
id=-996471 se id- 115055 1&content; id--3195209 1&question; n... Question 9 Asking the user to enter a number. The number should be muttiplied by 10 and the result stored in a variable named product. The loop should iterate as long as hile ?100: num - input( "Enter an number:) num, float (num) product num10 print( "the product is product) flag True while flagTrue: num input f enter an number product num 10 print("the product is , product) if product 100: flag False flag True while flag Trues num input("Enter an nunber: ") num float(num) product num 10 print( the product is if product > 100: product) break while product t-0 num - float(num) tnum 10 print("the product is ", product) if product 100 breakExplanation / Answer
option (b) is correct
flag=True
while flag==True:
num=input("Enter a number:")
num=float(num)
product=num*10
print("product is ",product)
if product>=100: //iterate till product has value less than 100
flag=False
option (a) is incorrect because of condition (while product<=100 ), the loop will run for value 100 also. Same is case with option (c) if product>100 break;
option(d) is incorrect since it breaks out of loop if product is 100, higher values are neglected.
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.