Answer to Question #345293 in Python for jazz

Question #345293

Ask the user to input a number and then ask if they want to double the number. If they answer “y”multiply the number by 2 and display the answer. Keep repeating this loop, doubling their number each time, until they no longer reply “y”.

1
Expert's answer
2022-05-26T14:07:51-0400
n = int(input('Input a number: '))
answer = str(input('Do you want to double it? '))
while answer == 'y':
    n=n*2
    print(n)
    answer = str(input('Do you want to double it? '))

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS