Python Project β€” Quiz Game

Follow along using online-python.com

Project Overview

We’re building a Python Quiz Game! This project will teach you how to:

Open Online Python

Step 1: Greeting the Player

print("πŸŽ‰ Welcome to the Python Quiz Game! πŸŽ‰")
name = input("What's your name? ")
print("Hello " + name + "! Let's test your knowledge.\n")

This welcomes the player and asks for their name.

Step 2: Asking Questions

score = 0

print("1) What does CPU stand for?")
print("a) Central Processing Unit")
print("b) Computer Personal Unit")
print("c) Central Print Utility")
answer = input("Your answer: ").lower()

if answer == "a":
print("βœ… Correct!\n")
score += 1
else:
print("❌ Incorrect. The answer is a) Central Processing Unit.\n")

Notice how we use if/else to check the answer.

Step 3: Add More Questions

Repeat the structure above for more questions. Here’s another example:

print("2) Which programming language is known for the snake logo?")
print("a) Java")
print("b) Python")
print("c) C++")
answer = input("Your answer: ").lower()

if answer == "b":
print("βœ… Correct!\n")
score += 1
else:
print("❌ Incorrect. The answer is b) Python.\n")

Step 4: Show the Score

print("🎯 You scored " + str(score) + " out of 2.")
if score == 2:
print("πŸ† Excellent job, " + name + "!")
elif score == 1:
print("πŸ‘ Good work, " + name + "!")
else:
print("πŸ’‘ Keep practicing, " + name + "! You'll get it next time.")

This shows the player’s final score and gives feedback.

Mini Challenge

🎯 Add a 3rd or 4th question of your own! Be creative β€” ask about technology, favorite foods, or fun facts.

Wrap-Up

You’ve built a working Python quiz game! You now know how to:

Keep customizing your quiz for practice!