courses / python / level 3

level 3 · expert

advanced
python.

Write Python like a professional: generators, decorators, async, tests and safe tools you can ship. Every example runs.

  • 28 lessons
  • 7 units
  • 5 h 33 m in all
  • £0, for good

what’s inside.

For people who build things on their own and want code that others trust and can change.

Python Level 3 is for people who finished Levels 1 and 2. In 28 lessons you learn the tools professionals reach for every day: comprehensions and generators, decorators, context managers, dataclasses, async code, performance thinking, argparse, mocks and safe input handling. It ends with a level check: a log analyser you ship yourself, tested on good logs, bad lines and bad options.

every lesson goes the same way.

  1. meet it
  2. guess first
  3. your turn
  4. fix it
  5. nailed it

unit 1

Smarter loops

Build, filter and stream data in a line or two.

4 lessons · 46 min

  1. Lists in one line10 minTurn a three-line loop into one clear line that builds a new list.
  2. Dictionaries and sets in one line11 minReshape a dictionary or find the different values in a single line.
  3. What a for loop really does12 minLook inside every loop and step through items by hand.
  4. Generators13 minWrite functions that hand out values one at a time, only when asked.

unit 2

Functions about functions

Pass functions around, wrap them and give them a memory.

4 lessons · 49 min

  1. Functions are values11 minHand a function to another function, and sort anything by anything.
  2. Any number of arguments12 minWrite functions that take names, defaults and as many values as you like.
  3. Functions that remember12 minBuild functions that carry their own private memory around.
  4. Decorators14 minAdd logging, checks and more to any function without touching its code.

unit 3

Shapes and clean-up

Describe your data clearly and always tidy up after yourself.

4 lessons · 47 min

  1. Inside the with statement12 minSee what with does for you, and build your own clean-up object.
  2. Context managers from a generator12 minWrite set-up and clean-up as one short function instead of a class.
  3. Type hints11 minWrite down what each value should be, so people and tools can check.
  4. Dataclasses12 minDescribe a record in a few lines and get a whole working class.

unit 4

Work smarter

Use Python's toolbox, and make your code fast where it matters.

4 lessons · 46 min

  1. The itertools toolbox11 minJoin, number and slice streams of data without building lists.
  2. Counting steps12 minJudge how much work code does, and spot the line that will slow it down.
  3. Choosing the right structure12 minTurn slow searches into one step, and tally or group data in a line.
  4. Remembering answers11 minStop a function working out the same answer twice.

unit 5

Waiting well

Wait for slow things without wasting time, and survive when they fail.

4 lessons · 49 min

  1. Coroutines12 minWrite functions that pause while they wait for a slow reply.
  2. Doing things at the same time12 minWait for several slow replies at once instead of one after another.
  3. Tasks12 minStart slow work in the background and collect the result later.
  4. When waiting goes wrong13 minGive up on slow replies and keep going when one job fails.

unit 6

Programs and tests

Give programs a front door and options, and test them properly.

4 lessons · 48 min

  1. Programs with a front door10 minMake a file that runs as a program but stays quiet when imported.
  2. Command-line arguments12 minLet people choose what your tool does with words like --top 3.
  3. Testing well13 minWrite tests that check one thing each and find bugs at the edges.
  4. Fakes with unittest.mock13 minTest code that pays, emails or rolls dice, without doing any of it.

unit 7

Safe and shipped

Guard your program's edges, keep secrets secret and ship a real tool.

4 lessons · 48 min

  1. Checking input at the door12 minReject bad data the moment it arrives, with errors of your own.
  2. Secrets10 minMake tokens and codes that nobody can guess, and check them safely.
  3. Failing politely11 minTurn expected errors into one clear sentence and an exit code.
  4. Shipping a tool15 minJoin generators, dataclasses, options and polite errors into one program.
end of level 3 level check: a shipped log analyser Build one small project with everything from this level. Pass it and your face levels up. see the check

finished python?

pick your next language.

see all courses