CurriculumPython Dictionaries for KidsThe Full Roster Check
Practice Challenge: A Full Python Party Roster
Dicts, lists, loops, and decisions — a whole party, checked one dragon at a time.
The Full Roster Check
You know dicts, and you know lists. Now put a list of dicts together — a whole roster.
party = [{"name": "Ember"}, {"name": "Blaze"}] — a LIST holding DICTS. Loop over it, and each item is one dict.
party = [{"name": "Ember"}, {"name": "Blaze"}]
for dragon in party:
print(dragon["name"])Output
Ember
BlazeAdd an if/elif/else INSIDE that loop, using one of the dict's own keys, and you can react differently to each dragon based on its own stats.
Check your understanding
party = [{"hp": 10}, {"hp": 80}]. Using if hp < 20 / else, how many lines print for a loop that reacts to each dragon?
Why: 2. One pass through the loop per dragon, one decision per pass, one line printed — exactly like every earlier boss's loop-plus-branch pattern.
What you'll practice
party = [{"name": "Ember"}, {"name": "Blaze"}, {"name": "Frost"}]. Loop over the party and print each dragon's name — using for dragon in party: dragon["name"], not indexing.
More from this topic
The Full Roster Check is one lesson inside Python Dictionaries for Kids — see the full lesson order and what the whole topic covers.
View the full topic →