141 views
3 votes
Write a program that accept a whole number a input, mutiplie that number by 21, and then output the product

User Jinzu
by
3.3k points

1 Answer

5 votes

Answer:

while True:

try:

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

break

except ValueError:

print("That is not a whole number. Try again.")

product = whole_number * 21

print("The product is", product)

Step-by-step explanation:

using while true and except ValueError to make sure the user enters a whole number

User Jpsh
by
3.2k points