277,600 views
24 votes
24 votes
Write a program that accept a whole number a input, mutiplie that number by 21, and then output the product

User Mvherweg
by
2.9k points

1 Answer

18 votes
18 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 James Linnell
by
2.7k points