Practice Challenge: A Full Python Party Roster

Dicts, lists, loops, and decisions — a whole party, checked one dragon at a time.

  • Lesson 4 of 5
  • PRO
  • Ages 10+
  • 3 hands-on levels
See what PRO unlocksA one-time $49.99 purchase. Topics 1–3 are free.

The dragon explains

The Full Roster Check

  1. The dragon: You know dicts, and you know lists. Now put a list of dicts together — a whole roster.

  2. The dragon: party = [{"name": "Ember"}, {"name": "Blaze"}] — a LIST holding DICTS. Loop over it, and each item is one dict.

    example.pyPython 3
    party = [{"name": "Ember"}, {"name": "Blaze"}]for dragon in party:    print(dragon["name"])
    OutputEmber Blaze
  3. The dragon: Add 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.

Quick check

Check your understanding

Say your answer out loud before reading the marked one. Every wrong option is a mistake real beginners make.

  1. Question 1 of 1

    party = [{"hp": 10}, {"hp": 80}]. Using if hp < 20 / else, how many lines print for a loop that reacts to each dragon?

    • 2 — one reaction per dragonCorrect
    • 4 — every dragon checked against every rule

    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.

In the game

What you'll practice

Three levels in the game: one guided first try with the shape of the answer already there, then two to solve on your own.

  1. 1

    GuidedYour first try

    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.

  2. +2

    PracticeTwo more, on your own

This lesson is part of PRO.

PRO is a one-time $49.99 purchase, no subscription, and unlocks this whole topic along with everything else. Topics 1–3 are free, start to finish.

Unlock this lesson with PRO

Stuck three times? The game offers the answer — unasked.