import random import math num = random.randint(1, 12) result = math.sqrt(num) rounded_result = round(result, 2) def sqrt_check(): while True: error = "Please enter a number." try: maths_answer = float(input(f"What is the square root of {num}? ")) # check the user says the correct answer if maths_answer == result: print(f"Correct! The square root of {num} is {result}!") break elif maths_answer == rounded_result: print(f"Correct! The square root of {num} is {rounded_result}!") break else: print(f"Incorrect. The square root of {num} is {result} or {rounded_result}") break except ValueError: print(error) # reword this for the main code print("End of quiz.")