CurriculumThe Dragon's Records

Choosing Python Data Structures, for Kids

The same information can be stored several genuinely different ways — this topic is about choosing which one fits the question you'll actually ask.

12 exercises4 lessonsAges 10+PRO
See what PRO unlocks →

What this topic covers

By this point a child knows lists and dictionaries as separate tools, but has rarely been asked to choose between them for the SAME piece of information. This topic opens by storing one small roster of characters four different ways — two parallel lists, a list of dictionaries, a dictionary of lists — so the tradeoffs are something a learner can observe directly rather than take on faith: which shape makes 'process everyone one at a time' natural, and which makes 'grab one field from everyone at once' natural.

Nested access follows as its own real skill, not an extension of something already covered: reading a value two levels deep, looping over nested data with a loop inside a loop, and updating a value that lives inside a dictionary that lives inside a list — a genuinely different move from updating a flat variable, even though it looks similar at a glance.

The topic closes with sets, introduced for the one job they do better than any other structure: removing duplicates and checking membership quickly. It states their real limitation directly rather than working around it quietly — a set has no guaranteed order, so printing one reliably means converting it to a sorted list first — and ends with a combined exercise where the actual skill being tested is choosing the right tool for each of several different questions about the same data.

Python from this topic

party = [{'name': 'Ember', 'hp': 40}, {'name': 'Blaze', 'hp': 25}]
for dragon in party:
    print(dragon['name'], 'has', dragon['hp'], 'hp')

Output

Ember has 40 hp
Blaze has 25 hp

Python covered here

  • The same data as two parallel lists, a list of dicts, and a dict of lists
  • Looping over nested data, including a loop inside a loop
  • Updating a value that lives one level deep
  • Sets for removing duplicates and checking membership
  • Why a set's order isn't guaranteed, and when to use sorted()
  • Choosing the right structure for the question being asked

The mistake this topic is built to fix

Common mistakeA child treats data-structure choice as arbitrary — reaching for whichever shape they used last, rather than the one that fits the question they actually need to answer.

Modeling data well is a judgment call most curricula never make explicit, leaving learners to imitate examples rather than reason about tradeoffs. This topic makes the comparison direct: the same information, stored four ways, so which shape suits which question becomes something observed rather than asserted.

The lessons, in order

  1. The same data, four shapesTwo parallel lists, a list of dicts, a dict of lists — the same info, genuinely different tradeoffs.3 exercises
  2. Nested access and the two-level loopLooping over nested data, and updating a value that lives one level deep.3 exercises
  3. Sets: no duplicates, fast membershipThe one structure whose whole job is 'no repeats' — and the one honest limit that comes with it.3 exercises
  4. The Dragon CensusThree questions about one list of dragons — choosing the right tool for each, without new tricks.3 exercises

Lessons unlock in order within a topic, so nothing arrives before the idea it depends on. This topic is part of PRO — $6.99 unlocks it along with everything else.

Try it now

The very first level needs no account at all — see whether it clicks before signing up for anything.

Play the first level free →