# File: badger1.py # # Keep asking the user to type in a number # until the user types in a valid number. # done = False while not done: try: # get input string and convert to integer # userInput = input("Enter a number: ") n = int(userInput) except ValueError: # exception triggered for input not a valid # integer # print("That's not an integer! Try again.") else: # no exceptions found. Can quit now. # print("Thank you!") done = True print("n is ", n)