Intermediate · Free · In your browser

Learn Python Intermediate

Go beyond the basics. Master functions, closures, and decorators, use Python’s data tools, design classes that behave like built-in types, handle errors and test your code, work with dates, JSON, and regular expressions, and build a command-driven task tracker.

20 lessons6 modules4 hours of practice4 challenges
Start the Python Intermediate course →

No installation. Your code runs right in the browser. Finish Python Foundations first, or be comfortable with functions, loops, lists, and dictionaries.

What you will be able to do

Course outline

Module 1

Functions, deeper

Default and keyword arguments, flexible arguments, closures, and decorators.

  1. Defaults and keyword argumentsDefault values, keyword-only parameters & the mutable default trap · 10 min
  2. Flexible arguments*args, **kwargs & unpacking calls · 10 min
  3. Functions that rememberFirst-class functions & closures · 10 min
  4. DecoratorsWrapping functions & functools.wraps · 12 min
Module 2

Work with data efficiently

Comprehensions, the collections toolbox, zip and enumerate, and itertools.

  1. Comprehensions beyond listsDict & set comprehensions with conditions · 9 min
  2. The collections toolboxdefaultdict, Counter & most_common · 10 min
  3. Pair and number thingszip, enumerate & ranking · 9 min
  4. Iteration recipesitertools.groupby, chain & islice · 11 min
Module 3

Objects that behave

Dataclasses, properties, special methods, and an inventory project.

  1. Data classes@dataclass, defaults & field(default_factory) · 11 min
  2. Properties and validation@property, setters & computed attributes · 11 min
  3. Objects that feel built-in__repr__, __len__, __iter__, __contains__ & __add__ · 12 min
  4. Project: an inventory managerFoundation project · classes, validation & reports · 20 min
Module 4

When things go wrong

Custom exceptions, context managers, and tests for your own code.

  1. Your own exceptionsCustom exception classes & raise … from · 10 min
  2. Clean up with context managerswith statements & contextlib.contextmanager · 12 min
  3. Test your own codeassert-based tests & edge cases · 12 min
Module 5

Real-world data

Dates and times, nested JSON, and parsing text with named groups.

  1. Dates and timesdate, timedelta & weekdays · 11 min
  2. Nested JSONjson.loads, recursion & flattening · 12 min
  3. Parse text with named groupsre named groups & structured results · 11 min
Module 6

Bigger programs

Lazy generator pipelines and a command-driven task tracker.

  1. Lazy pipelinesGenerators that transform streams · 11 min
  2. Capstone: a command-driven task trackerCapstone · dataclasses, parsing, errors & sorting · 28 min

Ready for your first line?

Every lesson is short, hands-on, and checked automatically.

Start learning Python Intermediate →