Write a multiplication game program for kids. The program should give the player ten ran�domly generated multiplication questions to do. After each, the program should tell them

whether they got it right or wrong and what the correct answer is.
Question 1: 3 x 4 = 12
Right!
Question 2: 8 x 6 = 44
Wrong. The answer is 48.
...
...
Question 10: 7 x 7 = 49
Right.


import random


num_correct = 0


for i in range(1, 11):

    # Generate two random numbers between 1 and 12

    num1 = random.randint(1, 12)

    num2 = random.randint(1, 12)


    # Prompt the player for the answer to the multiplication question

    answer = int(input(f"Question {i}: {num1} x {num2} = "))


    # Check if the answer is correct and print a message

    if answer == num1 * num2:

        print("Right!")

        num_correct += 1

    else:

        print(f"Wrong. The answer is {num1 * num2}.")


print(f"You got {num_correct} out of 10 questions correct.")


This program uses a for loop to generate ten random multiplication questions and prompts the player for the answer to each question. It checks if the player's answer is correct and prints a message accordingly. At the end, it prints the number of questions the player got right out of 10.

You could name this program "multiplication_game" or something similar.

Here is an example of the output of the program I provided:

Question 1: 5 x 4 = 20
Right!
Question 2: 7 x 9 = 63
Right!
Question 3: 6 x 8 = 48
Right!
Question 4: 3 x 7 = 21
Wrong. The answer is 21.
Question 5: 9 x 5 = 45
Right!
Question 6: 8 x 2 = 16
Right!
Question 7: 4 x 7 = 28
Right!
Question 8: 6 x 4 = 25
Wrong. The answer is 24.
Question 9: 3 x 3 = 9
Right!
Question 10: 2 x 7 = 14
Right!
You got 9 out of 10 questions correct.

This is an example of what the player might see when playing the multiplication game. The program generates ten random multiplication questions and the player answers them. Some of the answers are correct and some are incorrect, as indicated by the program's output. At the end, the program prints the number of questions the player got right out of 10.

Note that the output will vary depending on the questions generated and the player's answers. The program will generate ten random multiplication questions and print messages indicating whether the player's answers are correct or not.