>
Code Monsters Academy
Home › Blog › Python games

Python Quiz Games: Score Keeping and a Word Jumble

Quiz games are exercises in storing answers in a list, comparing strings and keeping score. Both examples below run in the terminal.

Quiz with a score

questions = [
    ("What is 7 x 8?", "56"),
    ("Which planet is closest to the Sun?", "mercury"),
    ("How many legs does a spider have?", "8"),
]
score = 0
for q, a in questions:
    if input(q + " ").strip().lower() == a:
        score += 1
print("Score:", score, "of", len(questions))

Sample output

(run it and you will see the prompt printed in the terminal)

Word jumble

import random

word = "monster"
letters = list(word)
random.shuffle(letters)
print("Unjumble:", "".join(letters))
guess = input("Your answer: ")
print("Yes!" if guess.lower() == word else "It was " + word)

Sample output

(run it and you will see the prompt printed in the terminal)

Common mistakes

Variations to try

More Python games

Overview of the whole set: Python games code to copy and paste.

If you prefer learning by playing, Code Monsters Academy teaches the same ideas one level at a time.