def int_check(question): while True: error = "please enter an whole number that is between 1-10 " to_check = input(question) if to_check == "": return "infinite" try: response = int(to_check) # checks that the number is okay if response < 1: print(error) elif response > 10: print(error) else: return response except ValueError: print(error) # main routine goes here target_score = int_check("what would you rate this quiz between 1-10? ") print(target_score)