def round_check(question): while True: error = "Please enter an integer that is between 5 and 15." to_check = input(question) # check for infinite mode if to_check == "": return "infinite" elif to_check == "xxx": return "xxx" try: response = int(to_check) # check that the number is more than / equal to 1 if response < 5: print() print(error) print() elif response > 15: print() print(error) print() else: return response except ValueError: print() print(error) print() round_check("How many rounds? ")