# functions go here # checks users enter an integer to given question def num_check(question): while True: try: response = int(input(question)) return response except ValueError: print("Please enter an integer.") # Main routine goes here rooms_sold = 0 while True: name = input("Enter your name / xxx to quit: ") if name == "xxx": break age = num_check("Age: ") if 18 <= age <= 120: pass elif age < 18: print("Sorry you are too young to book a room") continue else: print("?? That looks like a typo, please try again.") continue rooms_sold += 1 print("")