import random base = random.randint(2, 10) exponent = random.randint(2,5) result_2 = base ** exponent while True: error = "Please enter a number." try: maths_answer = int(input(f"What does {base} to the power of {exponent} equal? ")) # check the user says the correct answer if maths_answer == result_2: print(f"Correct! {base} to the power of {exponent} does equal {result_2}!") break else: print(f"Incorrect. {base} to the power of {exponent} equals {result_2}.") break except ValueError: print(error) # reword this for the main code print("End of quiz.")