Python for Kids · Class 9 · Module 2 of 9

Advanced Collections

Five lines of loop, or one line that says exactly the same thing.

8 sessionsSessions 9–16
4 weeksTypical pace
Intermediate to AppliedLevel
Class 9Python & Coding
A numbered list shelf with items in slots zero to three
The big idea

Comprehensions let students express filtering and transforming as a single readable expression. Combined with confident handling of nested data, this is the toolkit for reshaping real-world information.

Why it matters

Data arrives in the wrong shape almost always. Reshaping it quickly and correctly is the everyday work of anyone who codes with data.

Unpacked

What you will actually learn

Three core ideas, each taught with worked examples and then practised until it feels obvious.

01

Comprehensions

A comprehension builds a new collection from an old one in one expression: [n * 2 for n in numbers if n > 0]. Read it as “for each, if, do this”.

02

Nested data

Nested data needs careful traversal — a list of dictionaries each containing a list. Naming loop variables honestly prevents most confusion.

03

Transformations

Transformations convert between shapes: list to dictionary, grouped by category, filtered and sorted. This is the core of data preparation.

Did you know?

Comprehension syntax comes from set-builder notation in mathematics: {x² | x ∈ N, x < 10} translates almost directly into Python.

Common mix-up

“Shorter is always better.” A comprehension four levels deep is worse than a plain loop. Clarity wins over compression.

Session by session

Your 8-session journey

Sessions 916 of the 72-session year, at two one-hour sessions per week.

  1. 1

    Warm-up and big picture

    Where this module fits, what you will build, and a hands-on starter that gets everyone curious about comprehensions.

  2. 2

    Comprehensions

    Guided teaching on comprehensions, worked through together with the teacher.

  3. 3

    Comprehensions — practice lab

    Independent practice, small challenges and one deliberate mistake to diagnose.

  4. 4

    Nested data

    Guided teaching on nested data, building directly on the previous two sessions.

  5. 5

    Nested data — practice lab

    Applied tasks that combine comprehensions and nested data in one piece of work.

  6. 6

    Transformations

    Transformations introduced and practised, completing the toolkit needed for the project.

  7. 7

    Project build

    Guided build session for the module project: Data-cleaning challenge.

  8. 8

    Test, present and reflect

    Finish, test against the checklist, present the work and explain the decisions behind it.

Project lab

Data-cleaning challenge

Every module ends with something the student built themselves and can demonstrate. This is the piece that goes into their portfolio and gets explained out loud at the end of session 16.

Try this at home

Take a messy dataset and clean it using only comprehensions, then rewrite the same work as loops and decide honestly which reads better.

It is finished when

  • It works from start to finish without breaking
  • You can explain every part of it in your own words
  • You tested it and improved at least one thing afterwards
  • Someone else used or understood it without your help

By the end of this module

Students finishing Module 2 can:

  • Explain and use comprehensions without prompting
  • Explain and use nested data without prompting
  • Explain and use transformations without prompting
  • Build and finish data-cleaning challenge
  • Test your own work and correct what you find
  • Talk an adult through what you made and why

Word bank

The vocabulary introduced here, in plain language:

comprehension
A compact expression that builds a collection.
transformation
Converting data from one shape to another.
filter
Keeping only the items that meet a condition.
Module challenge

Think you have got this?

0 XPLevel 1 · Curious Beginner

6 quick questions drawn from this module — vocabulary, the project you build, and a myth-or-fact round. Every wrong answer explains itself, so a mistake still teaches you something.

🎯 6 questions⚡ Up to 80 XP

Your child's free trial is one message away.

Tell us your child’s class and what they enjoy. We will suggest the closest program fit—no pressure and no upfront payment.