Programming · Advanced

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.

0%Not started
Level 1 · 7 classes and an exam

Data structures that do the work

Count, group, keep the last few and pick the smallest with the right built-in tool.

0/8

Recap of this level

  1. Class 1Count things with CounterYou are herePlus · Ultra
  2. Class 2Group with defaultdictPlus · Ultra
  3. Class 3Keep only the last few: dequePlus · Ultra
  4. Class 4Records with names: namedtuplePlus · Ultra
  5. Class 5The smallest few: heapqPlus · Ultra
  6. Class 6Sort by several things at oncePlus · Ultra
  7. Class 7On your own: low stock alertsPlus · Ultra
  8. Level exam · 4 questionsThe weekly order summaryPlus · Ultra
Level 2 · 8 classes and an exam

Functions in depth

Closures, map, partial, reduce, caching, named-only arguments and decorators with settings.

0/9

Recap of this level

Pass the level 1 exam to open this level.

  1. Class 8A function that remembers: closuresPlus · Ultra
  2. Class 9Apply one rule to every item: mapPlus · Ultra
  3. Class 10Fix some arguments: partialPlus · Ultra
  4. Class 11Fold a list into one value: reducePlus · Ultra
  5. Class 12Remember answers: lru_cachePlus · Ultra
  6. Class 13Arguments that must be namedPlus · Ultra
  7. Class 14A decorator with settings: retry(times)Plus · Ultra
  8. Class 15On your own: a call logPlus · Ultra
  9. Level exam · 4 questionsA cache with countersPlus · Ultra
Level 3 · 7 classes and an exam

Iteration

Your own iterators, generators and lazy pipelines that read only what they need.

0/8

Recap of this level

Pass the level 2 exam to open this level.

  1. Class 16Make your own iteratorPlus · Ultra
  2. Class 17Stop at the first matchPlus · Ultra
  3. Class 18Walk nested lists: yield fromPlus · Ultra
  4. Class 19Runs of the same value: groupbyPlus · Ultra
  5. Class 20One page of a long feed: islicePlus · Ultra
  6. Class 21A lazy pipeline over a logPlus · Ultra
  7. Class 22On your own: batches for the label printerPlus · Ultra
  8. Level exam · 4 questionsWork sessions from a click logPlus · Ultra
Level 4 · 7 classes and an exam

Object design

Classes that compare, add, guard their values and stay short with dataclasses and enums.

0/8

Recap of this level

Pass the level 3 exam to open this level.

  1. Class 23Objects that compare and print wellPlus · Ultra
  2. Class 24Add objects with +Plus · Ultra
  3. Class 25Guard a value with a propertyPlus · Ultra
  4. Class 26Another way to build an objectPlus · Ultra
  5. Class 27Less boilerplate: dataclassesPlus · Ultra
  6. Class 28Fixed choices: EnumPlus · Ultra
  7. Class 29On your own: an inventory classPlus · Ultra
  8. Level exam · 4 questionsSoftware versions that sort rightPlus · Ultra
Level 5 · 8 classes and an exam

Robust code

Clear errors, cleanup that always runs, patterns in text, and tests that catch bugs.

0/9

Recap of this level

Pass the level 4 exam to open this level.

  1. Class 30Your own kind of errorPlus · Ultra
  2. Class 31Keep the first error: raise fromPlus · Ultra
  3. Class 32Clean up every time: context managersPlus · Ultra
  4. Class 33Find patterns in text: rePlus · Ultra
  5. Class 34Read a log line with named groupsPlus · Ultra
  6. Class 35Write tests that catch bugsPlus · Ultra
  7. Class 36Take it to a real machine: a script you run from the terminalPlus · Ultra
  8. Class 37On your own: load a price file safelyPlus · Ultra
  9. Level exam · 4 questionsCourse exam: the log reportPlus · Ultra
Finish line: Advanced PythonEach level exam you pass gives you that level's trophy. Pass every level exam to finish the course and graduate.