Advanced Python
The standard library, closures and decorators, generators, well-designed classes, and code that fails safely, on real work tickets.
What runs here: Real Python 3 runs in your browser, and a hidden check tests your code on new values.
- 5 levels
- 37 hands-on classes
- 5 level exams
- about 7 h
What you'll be able to doWrite Python the way working developers do: the standard library, closures and decorators, generators, well-designed classes, clear errors and unit tests.
Data structures that do the work
Count, group, keep the last few and pick the smallest with the right built-in tool.
- Class 1Count things with CounterYou are herePlus · Ultra
- Class 2Group with defaultdictPlus · Ultra
- Class 3Keep only the last few: dequePlus · Ultra
- Class 4Records with names: namedtuplePlus · Ultra
- Class 5The smallest few: heapqPlus · Ultra
- Class 6Sort by several things at oncePlus · Ultra
- Class 7On your own: low stock alertsPlus · Ultra
- Level exam · 4 questionsThe weekly order summaryPlus · Ultra
Functions in depth
Closures, map, partial, reduce, caching, named-only arguments and decorators with settings.
Pass the level 1 exam to open this level.
- Class 8A function that remembers: closuresPlus · Ultra
- Class 9Apply one rule to every item: mapPlus · Ultra
- Class 10Fix some arguments: partialPlus · Ultra
- Class 11Fold a list into one value: reducePlus · Ultra
- Class 12Remember answers: lru_cachePlus · Ultra
- Class 13Arguments that must be namedPlus · Ultra
- Class 14A decorator with settings: retry(times)Plus · Ultra
- Class 15On your own: a call logPlus · Ultra
- Level exam · 4 questionsA cache with countersPlus · Ultra
Iteration
Your own iterators, generators and lazy pipelines that read only what they need.
Pass the level 2 exam to open this level.
- Class 16Make your own iteratorPlus · Ultra
- Class 17Stop at the first matchPlus · Ultra
- Class 18Walk nested lists: yield fromPlus · Ultra
- Class 19Runs of the same value: groupbyPlus · Ultra
- Class 20One page of a long feed: islicePlus · Ultra
- Class 21A lazy pipeline over a logPlus · Ultra
- Class 22On your own: batches for the label printerPlus · Ultra
- Level exam · 4 questionsWork sessions from a click logPlus · Ultra
Object design
Classes that compare, add, guard their values and stay short with dataclasses and enums.
Pass the level 3 exam to open this level.
- Class 23Objects that compare and print wellPlus · Ultra
- Class 24Add objects with +Plus · Ultra
- Class 25Guard a value with a propertyPlus · Ultra
- Class 26Another way to build an objectPlus · Ultra
- Class 27Less boilerplate: dataclassesPlus · Ultra
- Class 28Fixed choices: EnumPlus · Ultra
- Class 29On your own: an inventory classPlus · Ultra
- Level exam · 4 questionsSoftware versions that sort rightPlus · Ultra
Robust code
Clear errors, cleanup that always runs, patterns in text, and tests that catch bugs.
Pass the level 4 exam to open this level.
- Class 30Your own kind of errorPlus · Ultra
- Class 31Keep the first error: raise fromPlus · Ultra
- Class 32Clean up every time: context managersPlus · Ultra
- Class 33Find patterns in text: rePlus · Ultra
- Class 34Read a log line with named groupsPlus · Ultra
- Class 35Write tests that catch bugsPlus · Ultra
- Class 36Take it to a real machine: a script you run from the terminalPlus · Ultra
- Class 37On your own: load a price file safelyPlus · Ultra
- Level exam · 4 questionsCourse exam: the log reportPlus · Ultra

