keyboard_arrow_left keyboard_arrow_right

Aarav's Project

Multiplication Game

About Aarav

My name is Aarav Mukesh, I am 11 years old and study in 6th grade at NMS-DPS. I have many hobbies like making games, reading books, playing games and talking with friends.
I started gaining interest in coding when I started seeing how games were made. I soon found that they do coding to make games and like that I got into python coding.

Aarav's project details:

It's a multiplication game in which you get to choose double-digit multiplication and single-digit multiplication.
Each time the question is random and if you get it right you will get a point and it goes on infinitely. If you get a question wrong it will end the game and will tell your score.

import time
import random
print("Hello! Welcome to my math game")
time.sleep(2)
difi = input(print("Please select your difficulty, press 1 for single digit and press 2 for double digit"))
difi1 = int(difi)
if difi1 == 2:
    a = (random.randint(11,19))
    b = (random.randint(11,19))
if difi1 == 1:
    a = (random.randint(1,9))
    b = (random.randint(1,9))
score = 0
ans = a * b
print("Multiply these number:", a,"x",b)
guess = input('Write your answer here: ')
guess1 = int(guess)
if guess1 == ans:
    print("You Are Correct!")
    score = score + 1
    print(score)
    while guess1 == ans:
        a = (random.randint(1, 9))
        b = (random.randint(1, 9))
        ans = a * b
        print("Multiply these number:", a, "x", b)
        guess = input('Write your answer here: ')
        guess1 = int(guess)
        if guess1 == ans:
            print("You Are Correct!")
            score = score + 1
            print("Your score is: ", score)
else:
    print("Sorry That's the wrong answer. Better luck next time")
    print("Your score is: ", score)
print("Game ended. Press RUN button again to restart the game")
                                           
Name: Aarav Mukesh
Grade: 6
Be the Next Creator like :