# a. Title: Maths Quiz # b. Author: Dima Bykov # c. Date: 27/05/2026 # d. Ver: 1 # e. Purpose: To present random numbers that would be used in the question import random def script(): print('Welcome to my Maths Quiz!!!') print("I'm going to ask you some questions!! Good Luck") ##Determine the random numbers num_1 = random.randint(1, 10) num_2 = random.randint(1, 10) correct_answer = num_1 * num_2 num_3 = random.randint(1, 10) num_4 = random.randint(1, 10) correct_answer2 = num_3 * num_4 ##Ask the user the first question answer = int(input(f'What is {num_1} x {num_2}? ')) ##Check input verses the correct answer if answer == correct_answer: print('You got it right!!') print('Score: 1') elif answer < correct_answer: print(f'Too low!!! The answer is {correct_answer}.') print('Score: 0') elif answer > correct_answer: print(f'Too high!! The answer is {correct_answer}.') print('Score: 0') else: print(f'Your wrong!! The answer is {correct_answer}.') print('Score: 0') ##Asks the user the second question answer_2 = input(f'What is {num_3} x {num_4}? ') ##Check input versus the correct answer if answer_2 == correct_answer2: print('You got it right!!') print('Score: 2') elif answer_2 << correct_answer2: print(f'Too low!!! The answer is {correct_answer2}.') print('Score: 1') elif answer_2 >> correct_answer2: print(f'Too high!! The answer is {correct_answer2}.') print('Score: 1') else: print(f'Your wrong!! The answer is {correct_answer2}.') print('Score: 1') ##Restart the program restart = input('Would you like to restart the program? ') if restart == 'yes' or restart == 'y': script() elif restart == 'no' or restart == 'n': print('Script terminanating. Goodbye.') else: print('Invalid choice. Terminanating program.') script()