Python
Python 3.14 from a first program to production code: values, control flow, functions, data structures, files, classes, typing, testing and asyncio.
156 lessons: 5 free, 81 free with Pro answers, 66 with a free core and 4 with a free intro.
Examples run with Python 3.14.8 and Pyodide 314.0.7.
Who it is for
First-time programmers, students preparing for exams and coding interviews, and working developers who need modern Python (typing, async, packaging, testing).
What you will be able to do
- Write, run and debug Python 3.14 programs from a terminal, an editor and the browser
- Use the built-in types and data structures, and choose the right one for a task
- Structure programs with functions, modules, packages and classes
- Read and write files and common data formats such as CSV and JSON
- Handle errors with exceptions and test code with doctest, unittest and pytest
- Add type hints and check them with a static type checker
- Write concurrent code with threads, processes and asyncio, and know when each helps
- Package, publish and profile a Python project
Revise and practise
- Practice: every exercise and quiz (164 exercises, 156 quizzes)
- Python flashcards
Modules and lessons
What the labels mean
- Free
- the whole lesson and every answer in it
- Free lesson, Pro answers
- the whole lesson is free; the model answers to its interview questions open with a pass
- Free core, Pro depth
- the core of the lesson is free; its in-depth parts open with a pass
- Free intro, Pro
- the first part is free; the rest opens with a pass
- Pro
- opens with a Pro, Premium or Ultimate pass
Minutes are reading time: “9 of 25 min free” means 9 minutes of the lesson are free.
What a pass opens in this track
138 in-depth parts and 378 interview answers. The same pass opens every other track and every Pro tool.
- Module 1
Getting started: install, run and read Python
What Python is, installing 3.14, the REPL and scripts, editors and the in-browser runner, virtual environments, uv, and reading tracebacks.
- What Python is and how it runs your code Free lesson, Pro answers: 20 minutes
- Install Python 3.14 on Windows, macOS and Linux Free: 15 minutes
- The Python REPL, scripts and the -m switch Free lesson, Pro answers: 20 minutes
- Editors, notebooks and the in-browser runner Free lesson, Pro answers: 20 minutes
- Virtual environments with venv and pip Free lesson, Pro answers: 20 minutes
- uv, pipx and inline script metadata in Python Free lesson, Pro answers: 20 minutes
- Read error messages and tracebacks calmly Free lesson, Pro answers: 25 minutes
- Module 2
Values, variables, numbers and strings
Names and objects, integers and floats, booleans and None, operators, strings and f-strings, input and output, and type conversion.
- Variables, objects and names in Python Free lesson, Pro answers: 20 minutes
- Integers, floats and arithmetic operators Free lesson, Pro answers: 20 minutes
- Floating-point surprises and how to handle them Free: 15 minutes
- Booleans, None, truthiness and comparisons Free lesson, Pro answers: 15 minutes
- Operators, precedence and the walrus Free lesson, Pro answers: 15 minutes
- Strings: literals, indexing and slicing Free lesson, Pro answers: 25 minutes
- Essential string methods for cleaning text Free lesson, Pro answers: 15 minutes
- f-strings and the format mini-language Free lesson, Pro answers: 20 minutes
- Input and output: print(), input() and stdin Free lesson, Pro answers: 15 minutes
- Type conversion, number bases and bitwise operators Free lesson, Pro answers: 30 minutes
- Module 3
Control flow: decisions, loops and pattern matching
if, while and for, loop helpers such as range, enumerate and zip, match and case, and debugging with breakpoint() and pdb.
- Decisions with if, elif and else Free lesson, Pro answers: 25 minutes
- while loops, break, continue and loop else Free lesson, Pro answers: 20 minutes
- for loops with range, enumerate and zip Free: 40 minutes
- Nested loops and pattern printing Free lesson, Pro answers: 15 minutes
- Pattern matching with match and case Free lesson, Pro answers: 15 minutes
- Structural matching: lists, dicts and classes Free lesson, Pro answers: 20 minutes
- Debugging with print, breakpoint() and pdb Free lesson, Pro answers: 20 minutes
- Solving problems with loops step by step Free lesson, Pro answers: 20 minutes
- Module 4
Functions, scope, closures and decorators
Every kind of parameter, scope rules, lambdas and higher-order functions, closures, recursion, decorators and functools.
- Defining and calling functions Free lesson, Pro answers: 25 minutes
- Parameters: defaults, keyword-only, positional-only Free lesson, Pro answers: 20 minutes
- *args, **kwargs and argument unpacking Free lesson, Pro answers: 20 minutes
- Scope: local, enclosing, global and built-in Free lesson, Pro answers: 20 minutes
- Docstrings, comments and PEP 8 style Free lesson, Pro answers: 20 minutes
- Lambdas and higher-order functions Free lesson, Pro answers: 25 minutes
- Closures and the late-binding trap Free lesson, Pro answers: 20 minutes
- Recursion, the call stack and its limits Free lesson, Pro answers: 25 minutes
- Decorators: wrapping functions cleanly Free lesson, Pro answers: 20 minutes
- functools: cache, partial, reduce and more Free lesson, Pro answers: 25 minutes
- Module 5
Built-in data structures: lists, dicts, sets and more
Lists, tuples, dictionaries and sets, copying and aliasing, sorting, comprehensions, the collections module, text and bytes.
- Lists: create, index, slice and modify Free: 25 minutes
- References, aliasing, shallow and deep copies Free lesson, Pro answers: 20 minutes
- Sorting with key functions and stability Free lesson, Pro answers: 20 minutes
- Tuples, unpacking and named tuples Free lesson, Pro answers: 20 minutes
- Dictionaries: keys, values and views Free: 20 minutes
- Sets and frozensets for membership and maths Free lesson, Pro answers: 20 minutes
- List, dict and set comprehensions Free lesson, Pro answers: 25 minutes
- collections: deque, Counter, defaultdict and more Free lesson, Pro answers: 20 minutes
- heapq, bisect and array for efficient data Free lesson, Pro answers: 25 minutes
- Text vs bytes: Unicode, encodings, bytearray Free lesson, Pro answers: 25 minutes
- Choosing the right data structure Free lesson, Pro answers: 20 minutes
- Module 6
Modules, packages and the standard library
Imports and packages, installing third-party packages, a tour of the standard library, random numbers, exact arithmetic, dates and time zones.
- Modules, imports and __name__ Free lesson, Pro answers: 20 minutes
- Packages, __init__.py and relative imports Free lesson, Pro answers: 20 minutes
- Finding and installing third-party packages Free lesson, Pro answers: 15 minutes
- A tour of the Python standard library Free lesson, Pro answers: 20 minutes
- Random numbers, simulations and statistics Free lesson, Pro answers: 25 minutes
- math, decimal and fractions for exact work Free lesson, Pro answers: 20 minutes
- Dates, times and time zones (IST included) Free lesson, Pro answers: 20 minutes
- Module 7
Errors, exceptions and context managers
try and except, custom exceptions, chaining and notes, exception groups, the with statement, warnings and assertions.
- Handling exceptions with try and except Free lesson, Pro answers: 20 minutes
- Raising exceptions and custom error classes Free lesson, Pro answers: 20 minutes
- Exception chaining, notes and tracebacks Free lesson, Pro answers: 15 minutes
- Exception groups and except* Free lesson, Pro answers: 15 minutes
- Context managers and the with statement Free lesson, Pro answers: 25 minutes
- Warnings, assertions and development mode Free lesson, Pro answers: 20 minutes
- Designing error handling for real programs Free lesson, Pro answers: 20 minutes
- Module 8
Files, paths and data formats
Text and binary files, pathlib, CSV, JSON, configuration and secrets, archives, XML, safe serialisation and SQLite.
- Reading and writing text files safely Free lesson, Pro answers: 25 minutes
- pathlib: paths, folders and file operations Free lesson, Pro answers: 20 minutes
- CSV files with the csv module Free lesson, Pro answers: 20 minutes
- JSON: load, dump and custom types Free lesson, Pro answers: 20 minutes
- Config files, environment variables and secrets Free lesson, Pro answers: 25 minutes
- Binary files, struct and checksums Free lesson, Pro answers: 25 minutes
- Archives and compression: zip, tar, gzip, zstd Free lesson, Pro answers: 20 minutes
- XML and HTML parsing without security holes Free lesson, Pro answers: 20 minutes
- pickle, shelve and safe serialisation Free lesson, Pro answers: 25 minutes
- SQLite databases with sqlite3 Free lesson, Pro answers: 20 minutes
- Beyond SQLite: DB-API drivers and ORMs Free lesson, Pro answers: 20 minutes
- Module 9
Object-oriented Python and the data model
Classes and methods, properties, inheritance and composition, abstract base classes, special methods, enums and dataclasses.
- Classes, objects and __init__ Free lesson, Pro answers: 20 minutes
- Methods: instance, class, static and properties Free core, Pro depth: 9 of 25 minutes free
- Encapsulation: underscores and name mangling Free core, Pro depth: 7 of 20 minutes free
- Inheritance, super() and composition Free core, Pro depth: 8 of 20 minutes free
- Multiple inheritance, MRO and mixins Free core, Pro depth: 9 of 25 minutes free
- Abstract base classes and duck typing Free core, Pro depth: 7 of 20 minutes free
- Special methods: repr, str, eq and hash Free core, Pro depth: 9 of 25 minutes free
- Operator overloading done right Free core, Pro depth: 9 of 25 minutes free
- Custom containers: __getitem__, __iter__ and more Free core, Pro depth: 10 of 25 minutes free
- __slots__, weak references and object lifetime Free core, Pro depth: 7 of 20 minutes free
- Enums: Enum, IntEnum, StrEnum and Flag Free core, Pro depth: 8 of 20 minutes free
- Dataclasses for clean data objects Free core, Pro depth: 8 of 20 minutes free
- Module 10
Iterators, generators and functional tools
The iteration protocol, generators and pipelines, itertools, the built-in functions and a functional style in Python.
- How iteration works: iterables and iterators Free lesson, Pro answers: 20 minutes
- Generators and generator expressions Free core, Pro depth: 9 of 25 minutes free
- Generator pipelines, yield from and send Free core, Pro depth: 9 of 25 minutes free
- itertools: the iteration toolkit Free core, Pro depth: 8 of 20 minutes free
- Built-in functions every Python coder should know Free core, Pro depth: 8 of 20 minutes free
- Module 11
Type hints and static type checking
Annotations, running a type checker, generics, protocols, TypedDict and Literal, narrowing, overloads and annotations at run time.
- Why type hints help (and what they don't do) Free lesson, Pro answers: 15 minutes
- Annotating variables, functions and collections Free core, Pro depth: 8 of 20 minutes free
- mypy and pyright: running type checkers Free core, Pro depth: 6 of 15 minutes free
- Callable, Iterable, Sequence and type aliases Free core, Pro depth: 8 of 20 minutes free
- Generics with the [T] type-parameter syntax Free core, Pro depth: 8 of 20 minutes free
- Protocols and structural typing Free core, Pro depth: 6 of 15 minutes free
- TypedDict, Literal, NewType and enums Free core, Pro depth: 8 of 20 minutes free
- Type narrowing, TypeIs and exhaustiveness Free core, Pro depth: 6 of 15 minutes free
- Overloads, ParamSpec, Self and @override Free core, Pro depth: 8 of 20 minutes free
- Annotations at run time with annotationlib Free core, Pro depth: 8 of 20 minutes free
- Typing libraries: py.typed and stub files Free core, Pro depth: 8 of 20 minutes free
- Validating external data at run time Free core, Pro depth: 8 of 20 minutes free
- Module 12
Testing, debugging and code quality
doctest, unittest and pytest, fixtures and mocks, property-based tests, coverage and CI, and linting and formatting.
- Why and how to test Python code Free lesson, Pro answers: 20 minutes
- doctest: examples that test themselves Free core, Pro depth: 8 of 20 minutes free
- unittest: test cases, fixtures and discovery Free core, Pro depth: 8 of 20 minutes free
- Ruff and pre-commit: lint and format Python Free core, Pro depth: 8 of 20 minutes free
- Module 14
Concurrency and parallelism: threads, processes, interpreters
The GIL, threads and synchronisation, subprocesses, multiprocessing, concurrent.futures, free-threaded builds and subinterpreters.
- Concurrency models and the GIL explained Free lesson, Pro answers: 20 minutes
- Threads: threading and ThreadPoolExecutor Free core, Pro depth: 9 of 24 minutes free
- Thread safety: locks, events and queues Free core, Pro depth: 8 of 20 minutes free
- Running other programs with subprocess Free core, Pro depth: 8 of 22 minutes free
- Processes with multiprocessing and pools Free core, Pro depth: 9 of 25 minutes free
- concurrent.futures: submit, map, as_completed Free core, Pro depth: 9 of 24 minutes free
- Running Python without the GIL (3.14t builds) Free core, Pro depth: 9 of 24 minutes free
- Subinterpreters with concurrent.interpreters Free core, Pro depth: 9 of 24 minutes free
- Module 15
Async programming with asyncio
The event loop, tasks and TaskGroup, timeouts and cancellation, async iterators, queues, streams and mixing blocking code with async.
- Async Python: the event loop mental model Free lesson, Pro answers: 25 minutes
- Tasks, gather and running coroutines Free core, Pro depth: 9 of 25 minutes free
- TaskGroup and structured concurrency Free core, Pro depth: 9 of 25 minutes free
- Timeouts, cancellation and clean-up in asyncio Free core, Pro depth: 8 of 20 minutes free
- Async iterators, generators and context managers Free core, Pro depth: 7 of 20 minutes free
- Queues, semaphores and rate limits in asyncio Free core, Pro depth: 7 of 20 minutes free
- Networking with asyncio streams Free core, Pro depth: 7 of 20 minutes free
- Mixing blocking code with asyncio Free core, Pro depth: 7 of 20 minutes free
- Context variables and thread-local data Free core, Pro depth: 10 of 25 minutes free
- Debugging asyncio with 3.14 introspection tools Free core, Pro depth: 7 of 20 minutes free
- Choosing concurrency: a measured comparison Free core, Pro depth: 9 of 25 minutes free
- Module 16
Practical Python: text, CLIs, web, automation and security
Regular expressions, template strings, logging, argparse, the operating system, web APIs and servers, automation and secure coding.
- Regular expressions with the re module Free lesson, Pro answers: 25 minutes
- Text tools: textwrap, difflib and string Free core, Pro depth: 8 of 20 minutes free
- Template strings (t-strings) in Python 3.14 Free core, Pro depth: 8 of 20 minutes free
- Logging for scripts, applications and libraries Free core, Pro depth: 8 of 20 minutes free
- Command-line apps with argparse Free core, Pro depth: 8 of 20 minutes free
- Working with the OS: os, sys, shutil, platform Free core, Pro depth: 8 of 20 minutes free
- Calling web APIs from Python with urllib Free core, Pro depth: 9 of 25 minutes free
- Serving HTTP: http.server and WSGI basics Free core, Pro depth: 7 of 20 minutes free
- Web scraping responsibly: robots.txt and parsing Free core, Pro depth: 7 of 20 minutes free
- Socket programming basics: TCP and UDP Free core, Pro depth: 8 of 20 minutes free
- Automate office tasks: files, Excel, PDF, email Free core, Pro depth: 7 of 20 minutes free
- Desktop GUIs with tkinter: a first app Free core, Pro depth: 7 of 20 minutes free
- Secure tokens, password hashes and HMAC Free core, Pro depth: 8 of 20 minutes free
- Module 17
Performance, profiling and debugging in depth
Measuring with timeit, profiling CPU time and memory, proven speed-ups, when to reach for NumPy or C, bytecode and advanced debugging.
- Measuring speed correctly with timeit Free lesson, Pro answers: 20 minutes
- Profiling CPU time: cProfile and pstats Free core, Pro depth: 7 of 20 minutes free
- Finding memory problems with tracemalloc Free core, Pro depth: 7 of 20 minutes free
- Making Python code faster: proven techniques Free core, Pro depth: 6 of 20 minutes free
- Module 18
Advanced Python: data model, metaprogramming and internals
Attribute lookup, descriptors, metaclasses, introspection, the ast module, the import system and memory management.
- Attribute lookup and the data model Free lesson, Pro answers: 20 minutes
- Descriptors: how properties and methods work Free core, Pro depth: 7 of 20 minutes free
- Class creation: __init_subclass__ and metaclasses Free core, Pro depth: 10 of 25 minutes free
- Introspection: inspect, vars() and type() Free core, Pro depth: 8 of 20 minutes free
- The ast module: read code without running it Free core, Pro depth: 10 of 30 minutes free
- Inside the import system Free core, Pro depth: 7 of 20 minutes free
- Module 19
Python for coding interviews and online assessments
Input and output for coding rounds, the cost of built-in operations, the standard-library toolkit for problems, puzzles and interview concepts.
- Python for coding rounds: input, output, limits Free lesson, Pro answers: 25 minutes
- Time complexity of Python's built-in operations Free intro, Pro: 4 of 20 minutes free
- Classic college programs written the Python way Free intro, Pro: 5 of 20 minutes free
- Module 21
Python everywhere: data, web, AI and next steps
First steps with NumPy and notebooks, Python on the web, calling APIs safely, MicroPython, and what to learn next.
- NumPy first steps: arrays and vectorisation Free lesson, Pro answers: 25 minutes
- Jupyter notebooks: workflow and pitfalls Free lesson, Pro answers: 25 minutes
- Python for the web: WSGI, ASGI and frameworks Free lesson, Pro answers: 25 minutes
- MicroPython and Python on microcontrollers Free lesson, Pro answers: 18 minutes
- What to learn next: Python roadmaps Free lesson, Pro answers: 12 minutes
- Module 22
Capstone projects
Four projects that pull the track together, a command-line tool, a data cleaner, an async HTTP client and a small interpreter.
- Capstone 2: a CSV data cleaner and validator Free intro, Pro: 4 of 20 minutes free
- Capstone 4: build a small interpreter Free intro, Pro: 4 of 25 minutes free
Related tools
Official documentation
- The Python Tutorial (Python Software Foundation)
- The Python Standard Library (Python Software Foundation)
- What's New in Python 3.14 (Python Software Foundation)
- Python Packaging User Guide (Python Packaging Authority)