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 exercises
  • 4 lessons
  • Ages 10+
  • PRO

This topic is part of PRO — a one-time $49.99 purchase, no subscription. Topics 1–3 are free, start to finish, and the first level needs no account.

For parents & teachers

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.

Built around a real misconception

The mistake this topic is built to fix

Common mistake

A 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.

Why the topic is built around it

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.

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

Explain · Ask · Guided · Practice

The lessons, in order

Each lesson explains one idea in short steps, checks it landed with a question, walks through a guided first try, then leaves the child to practise on their own.

  1. Two parallel lists, a list of dicts, a dict of lists — the same info, genuinely different tradeoffs.

    • Explain
    • Ask
    • Guided 1 level
    • Practice 2 levels
  2. Looping over nested data, and updating a value that lives one level deep.

    • Explain
    • Ask
    • Guided 1 level
    • Practice 2 levels
  3. The one structure whose whole job is 'no repeats' — and the one honest limit that comes with it.

    • Explain
    • Ask
    • Guided 1 level
    • Practice 2 levels
  4. Three questions about one list of dragons — choosing the right tool for each, without new tricks.

    • Explain
    • Ask
    • Guided 1 level
    • Challenge 2 levels

Lessons unlock in order within a topic, so nothing arrives before the idea it depends on. This topic is part of PRO — $49.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