#a. Title: Multiplication Math Quiz #b. Author: Davi Barbosa #c. Date: 15/05/2026 #d. Version: 1 #e. Purpose: To test the users multiplication skills ##Start screen, Ask question, Get answer, Check answer, update score, increase difficulty, Repeat, Show final percentage, End or restart import random def play_game(): score = 0 question_count = 0 difficulty = 1 ##Welcome user and get username print('Hello and welcome to the Multiplication Math Quiz.') print('You will answer question on this topic that will get harder as you go') print('Answer your Math questions with numbers!') username = input('What name would you like to be called by? ') print(f'Good luck, {username}!') while question_count < 10: ##Set difficulty for certain scores if score <= 4: difficulty = 1 elif score <= 7: difficulty = 2 else: difficulty = 3 ##Generates the each number in the question for each difficulty level if difficulty == 1: num1 = random.randint(1,10) num2 = random.randint(1,10) elif difficulty == 2: num1 = random.randint(5,10) num2 = random.randint(11,15) else: num1 = random.randint(11,20) num2 = random.randint(10,15) ##Ask the math question user_answer = int(input(f'What is {num1} x {num2}? ')) ##Check answer correct_answer = num1 * num2 if correct_answer == user_answer: print('Correct!') score += 1 else: print('Incorrect!') question_count += 1 print(f'Score = {score} / {question_count}') ##Final percentage percentage = (score / 10) * 100 print(f'Final percentage = {percentage}%!') ##Restart loop while True: play_game() restart = input('Nice work, would you like to play again? (yes/no) ').lower() if restart == "yes": continue elif restart == "no": print('Thanks for playing') break else: print('Invalid input') break