๐Ÿ PyQuest๐Ÿ† Game: Quiz Show Champion ยท ๐Ÿ”ข Step 2: Keep Score
โญ 0 XP๐Ÿ Python is waking upโ€ฆ

Step 2: Keep Score ๐Ÿ”ข

One question is a warm-up. A quiz show needs a score! ๐Ÿ”ข

The trick is a variable that starts at zero and grows:

score = 0          # before any questions

score = score + 1  # every time they get one right

Read that second line right-to-left: take the old score, add 1, put it back in the box. If score was 2, it's now 3. ๐Ÿ“ฆ

Where does it go? Inside the if, so it only counts correct answers:

if answer == "paris":
    print("โœ… Correct!")
    score = score + 1

Your mission

Your first question is already there. Now:

  1. Add score = score + 1 when they get it right
  2. Ask 2 more questions the same way (that's 3 total)
  3. At the end, print their final score

Pssst โ€” number answers work too, they're just text: if answer == "42":

Your code

Press โ–ถ Run to see what your code does!