Upcoming: student sessions with AI researchers, software engineers, and technology mentors.
Back to projects
PythonBeginner30–45 minutes

Quiz Game

Students create a small quiz about science, math, sports, Rajasthan, or any topic they enjoy. It is a friendly first project for learning input, conditions, variables, and scoring.

Starter code

Read it. Run it. Change it.

Save the code below as quiz_game.py. The example is intentionally small enough for a student to explain line by line before adding new features.

quiz_game.pyPython
score = 0

answer = input("What planet is known as the Red Planet? ")
if answer.lower() == "mars":
    print("Correct!")
    score += 1
else:
    print("Not quite. The answer is Mars.")

answer = input("What is 5 x 6? ")
if answer == "30":
    print("Correct!")
    score += 1
else:
    print("Not quite. The answer is 30.")

print("Your final score is", score, "out of 2")

How to run it on a laptop

  1. 1. Install Python 3 if it is not already available.
  2. 2. Open IDLE, Thonny, VS Code, or any simple text editor.
  3. 3. Copy the code into a new file named quiz_game.py.
  4. 4. Run the file. No internet connection, database, or server is required.

Build it step by step

1

Ask a question

Use input() to collect an answer from the player.

2

Check the answer

Use if/else to decide whether the answer is correct.

3

Keep score

Increase a score variable after each correct answer.

4

Personalize it

Replace the sample questions with a topic the student knows well.

Make it your own

  • Add five more questions.
  • Give the player a percentage score at the end.
  • Create a cricket, science, or local-history version.