163k views
5 votes
Write a WHILE loop that lets the user enter a number.

The number should be multiplied by 10 and the result
stored in the variable product.
The loop should iterate as long as product contains
a value less than 100.
Display the product after the loop has terminated.

User Mykaf
by
4.4k points

1 Answer

6 votes

Answer:

while True:

number = int(input("Enter a number: "))

product = number * 10

if product > 100:

break

print(str(product))

Step-by-step explanation:

Create a while loop that iterates until a specific condition is created inside

Ask the user for the input

Multiply the input and put the result in product

Check if the product is greater than 100. If it is, stop the loop using break keyword

When the loop is done, print the product

User Adam Sampson
by
3.9k points