import random # checks for an integer between the high and low def int_check(question, low, high): while True: error = f"💡 Hint 💡 Please enter an integer more than {low} and below {high}" to_check = input(question) try: response = int(to_check) # checks that the number is equal or more if low <= response <= high: return response else: print(error) except ValueError: print(error) # game loop starts here number_1 = random.randint(1, 12) number_2 = random.randint(1, 12) # Ask user a multiplication question user_answer = int_check(f"Question: {number_1} x {number_2} = ", 1, 200) print("You answered: ", user_answer) # Find the correct answer correct_answer = number_1 * number_2 # Adjust game lost / game tied counters and add results to game history if user_answer == correct_answer: feedback = "Well done! That answer was correct ✅" else: feedback = f"Unlucky, that was incorrect ❌. The correct answer is: {correct_answer}" # Set up round feedback and output it to user # Add it to the game history list (include the round number) round_feedback = f"{number_1} x {number_2} = {user_answer}, {feedback}" print(round_feedback)