Included in at least one reviewed higher-education syllabus.
2.2 Lists, tuples, dicts and sets
You reach for the right container without thinking.
Before:00. Orientation & SetupUnlocks:03. Data Handling & Analysis04. Classical AI — Agents, Search & Knowledge Representation
Lists, tuples, dicts and sets are the containers reached for hundreds of times a week, each with a distinct cost profile: choosing a dict or set for membership checks instead of a list is often the difference between instant and minutes. It sits immediately after syntax because containers are where data actually lives. The trap with teeth is aliasing — assigning one list to another name copies nothing, and mutating through either name mutates both.
Work through these
Mutability and aliasing — the copy trap
Some containers can be changed after creation and some cannot, and two names can refer to the same object. Copying when you meant to and not when you did not is the first serious Python bug most people meet.
Slicing, sorting, custom sort keys
Taking sections of a sequence, and sorting by something other than the value itself. Custom sort keys are the tool that removes a surprising amount of awkward code.
Dict methods, defaultdict, Counter
Dictionaries with sensible behaviour for missing keys, and a ready-made counter. Both are in the standard library and both replace code people otherwise write by hand.
Set operations and membership cost
Sets give you union, intersection and difference, and membership testing that stays fast as they grow. Choosing a set over a list is frequently the whole performance fix.
Sign in to keep your progress.
Free resources
We haven't checked most of these for screen reader use yet.
Links last checked 29 Aug 2026.
Stuck here?
Ask a mentor. A real person answers, and they can see exactly which topic you're on. Usually within a couple of working days.
Checking your session…
Topics shown in module order.