from random import randint def int_check(question, low, high): while True: error = f"Please enter an integer that is more than {low} and below {high}" to_check = input(question) try: response = (int(to_check)) # checks that the number is more than / equal to 1 if low <= response <= high: return response else: print(error) except ValueError: print(error) #addinig rounds to code for i in range(5): # Generate random numbers num_1 = randint(2, 12) num_2 = randint(2, 12) # Generate correct answer correct_ans = num_1 * num_2 user_ans = int_check(f"what is {num_1} * {num_2}? ", 4, 144) # Compare user answer def compare_ans(user, ans): if user == ans: round_result = "correct" else: round_result = "incorrect" return round_result # checks the input in an integer