May-25-2020, 08:50 PM
I agree with buran that your assignment is a bit too vague. It tells you to check the user's input, but not what to check for or or how to respond to invalid input.
I'd do something like this:
I'd do something like this:
while True: try: temp = float(input("Enter your dog's age: ")) break except ValueError: print('Invalid input! Please enter numbers only.')This will keep prompting until the user enters something that can be converted to a float.