Lesson 19 — Python: Build a 3-Question Quiz Game
What you'll achieve: a working 3-question quiz game with a running score.
- if/else (Python)
- A structure that runs one block of code if a condition is true, and a different block if it's false.
- == (double equals)
- The Python symbol used to CHECK if two things are equal — different from = which SETS a value.
- .lower()
- A command that converts text to all lowercase, useful for ignoring case differences.
I Do
Watch your teacher build one full question live: score = 0, then answer = input("What is the capital of France? "), then if answer.lower() == "paris": print("Correct!") with score = score + 1, else: print("Wrong, it's Paris."). Python uses indentation, not brackets, to know what's "inside" the if. Using = instead of == inside an if is the single most common mistake.
We Do
Build the shared example step by step, running after the full block is in, testing with both a correct and incorrect answer. Then build a second question together, checking the score correctly reaches 2 after two correct answers.
You Do
- Start with
score = 0. - Write question 1: get an answer, compare it with if/else, update score if correct.
- Repeat the same pattern for questions 2 and 3.
- Print the final score with an f-string, for example
You scored {score} out of 3. - Test your quiz three times: all correct, all wrong, and a mix.
Before You Go
What did you learn today? Explain in your own words.
Exit Ticket
Show what you've learned today. This one's optional — teacher's discretion.
Open Exit Ticket →
BLC