79208432

Date: 2024-11-20 17:56:33
Score: 1
Natty:
Report link

Here is the short and really simple approach to ask user to enter an integer until it's done:

while True:
    try:
        quantity = int(input("Quantity: "))
        break
    except:
        print("Error: Quantity must be a whole number.")
Reasons:
  • Low length (0.5):
  • Has code block (-0.5):
  • Low reputation (1):
Posted by: Sergei Valert