Skip to content

Python Guides

Self-directed guides for learning Python, free for anyone.

Each guide follows the same four-part shape: Learn (step-by-step tutorials you can run in the browser), Recipes (short task-focused how-tos), Reference (quick lookups), and Concepts (short pieces explaining why things work the way they do).

Conditional logic Making decisions in code: if/elif/else, boolean operators, truthiness, match/case. Learn · 3Recipes · 3Reference · 3Concepts · 2

Data structures Lists, tuples, dictionaries, sets, comprehensions, slicing, and when to reach for each. Learn · 6Recipes · 5Reference · 5Concepts · 4

Collections Specialised containers: Counter, defaultdict, deque, namedtuple, and ChainMap. Learn · 4Recipes · 4Reference · 3Concepts · 2

Functions Defining functions, parameters, lambdas, type hints, docstrings, closures, and decorators. Learn · 7Recipes · 5Reference · 4Concepts · 4

Classes and objects Defining classes, dunder methods, data classes, inheritance versus composition, properties. Learn · 5Recipes · 4Reference · 3Concepts · 2

Dates and times Working with datetime, parsing and formatting, time zones, and the traps that catch everyone out. Learn · 3Recipes · 4Reference · 3Concepts · 2

Type hints Annotations, generics, Optional, TypedDict, and how mypy uses them to catch bugs before runtime. Learn · 4Recipes · 4Reference · 3Concepts · 2

Iterators and generators The iterator protocol, yield, generator expressions, and itertools — lazy pipelines that scale to streams and big data. Learn · 4Recipes · 4Reference · 3Concepts · 2

String processing Working with text: methods, formatting, searching, cleaning, and Unicode gotchas. Learn · 4Recipes · 4Reference · 3Concepts · 2

Numbers and maths Integers and floats, the 0.1 + 0.2 problem, exact Decimal and Fraction, and math/statistics/random. Learn · 4Recipes · 4Reference · 3Concepts · 2

File handling Reading and writing files, paths with pathlib, CSV and JSON, context managers, encodings. Learn · 4Recipes · 4Reference · 3Concepts · 2

Error handling Exceptions from first principles: raising, catching, custom exceptions, and when not to catch. Learn · 4Recipes · 4Reference · 3Concepts · 2

Logging and debugging The logging module, log levels, and debugging with pdb and breakpoints. Learn · 4Recipes · 4Reference · 3Concepts · 2

Regular expressions Pattern matching with the re module: syntax, groups, flags, and practical extraction. Learn · 4Recipes · 4Reference · 3Concepts · 2

Unit testing Writing tests with unittest: fixtures, assertions, testing exceptions, good test names. Learn · 4Recipes · 3Reference · 3Concepts · 2

Packages and packaging Modules, imports, virtual environments, pyproject.toml, and shipping your own code to PyPI. Learn · 6Recipes · 5Reference · 4Concepts · 3

Concurrency Overlapping work with threads, true parallelism with processes, and high-volume I/O with async/await. Learn · 4Recipes · 4Reference · 3Concepts · 2

Run Python in your browser

Every tutorial in Agilearn is a Jupyter notebook, and every code cell has its own Run button. Edit the code, hit run, and see the output on the page — no install, no signup, no server. The Python environment loads on first use and runs entirely client-side; your edits stay on your own machine.