error_int = "Please enter an integer that is between 1 and 50 " number_of_questions = 0 max_num = 50 min_num = 1 while True: try: count = int(input(f"How many questions do you want between {min_num} and {max_num}? ")) number_of_questions = int(count) if count < min_num: print(error_int) elif count > max_num: print(error_int) except ValueError: print(error_int)