Lesson 12 of 12
🏆 Final Project: Quiz Game!
What You'll Learn
- Combine all 11 lessons into one complete project
- Build a multi-question quiz with scoring
- Handle user input and display a final score
Build a Complete Python Quiz Game
You have learned variables, input, math, strings, lists, if/elif/else, for loops, while loops, and functions. Now put it all together! Here is the plan:
- Store questions and answers in lists
- Loop through each question
- Accept user input and check if it is correct
- Track the score with a variable
- Print results at the end
Starter Code
Python
# OKSTEM Quiz Game
# Lesson 12 - Final Project
def run_quiz():
questions = [
('What state is OKSTEM based in?', 'Oklahoma'),
('What language are we learning?', 'Python'),
('What does print() do?', 'displays text'),
]
score = 0
print('Welcome to the OKSTEM Quiz!')
print('-' * 30)
for question, answer in questions:
user_answer = input(question + ' ')
if user_answer.lower() == answer.lower():
print('Correct! +1 point')
score += 1
else:
print(f'Not quite. The answer was: {answer}')
print('-' * 30)
print(f'Final Score: {score}/{len(questions)}')
percentage = (score / len(questions)) * 100
print(f'Percentage: {percentage:.0f}%')
if percentage == 100:
print('Perfect score!')
elif percentage >= 60:
print('Good job!')
else:
print('Keep studying and try again!')
run_quiz()You Built This!
Every single concept in this program — variables, input, loops, conditions, functions, lists, math, strings — you learned in this course. This is real Python!
Challenges to Try
- ➕ Add 5 more questions about Oklahoma history or STEM facts
- 🔄 Add a while loop that lets the user play again
- 👔 Shuffle the question order using random.shuffle()
- 📋 Add a high score that is saved between rounds
Share Your Quiz!
Make your quiz about a topic YOU love — sports, music, animals, movies. Share it with friends and family. You are a Python programmer now!
Quick Check
Which Python concept lets you reuse a block of code by name?
If score = 7 and total = 10, what is (score/total)*100?
What does .lower() do to a string?