Your country

Tools that support it use your country for local currency, number formats, units and paper size. Your choice is saved only in this browser.

Type a name or a two-letter code. Use the up and down arrow keys to move through the countries, Enter to choose one and Escape to close.

Programming languages

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 to read 20 modules

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

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.

  1. 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.

    1. What Python is and how it runs your code Beginner Free lesson, Pro answers: 20 minutes
    2. Install Python 3.14 on Windows, macOS and Linux Beginner Free: 15 minutes
    3. The Python REPL, scripts and the -m switch Beginner Free lesson, Pro answers: 20 minutes
    4. Editors, notebooks and the in-browser runner Beginner Free lesson, Pro answers: 20 minutes
    5. Virtual environments with venv and pip Beginner Free lesson, Pro answers: 20 minutes
    6. uv, pipx and inline script metadata in Python Beginner Free lesson, Pro answers: 20 minutes
    7. Read error messages and tracebacks calmly Beginner Free lesson, Pro answers: 25 minutes
  2. 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.

    1. Variables, objects and names in Python Beginner Free lesson, Pro answers: 20 minutes
    2. Integers, floats and arithmetic operators Beginner Free lesson, Pro answers: 20 minutes
    3. Floating-point surprises and how to handle them Beginner Free: 15 minutes
    4. Booleans, None, truthiness and comparisons Beginner Free lesson, Pro answers: 15 minutes
    5. Operators, precedence and the walrus Beginner Free lesson, Pro answers: 15 minutes
    6. Strings: literals, indexing and slicing Beginner Free lesson, Pro answers: 25 minutes
    7. Essential string methods for cleaning text Beginner Free lesson, Pro answers: 15 minutes
    8. f-strings and the format mini-language Beginner Free lesson, Pro answers: 20 minutes
    9. Input and output: print(), input() and stdin Beginner Free lesson, Pro answers: 15 minutes
    10. Type conversion, number bases and bitwise operators Beginner Free lesson, Pro answers: 30 minutes
  3. 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.

    1. Decisions with if, elif and else Beginner Free lesson, Pro answers: 25 minutes
    2. while loops, break, continue and loop else Beginner Free lesson, Pro answers: 20 minutes
    3. for loops with range, enumerate and zip Beginner Free: 40 minutes
    4. Nested loops and pattern printing Beginner Free lesson, Pro answers: 15 minutes
    5. Pattern matching with match and case Beginner Free lesson, Pro answers: 15 minutes
    6. Structural matching: lists, dicts and classes Intermediate Free lesson, Pro answers: 20 minutes
    7. Debugging with print, breakpoint() and pdb Beginner Free lesson, Pro answers: 20 minutes
    8. Solving problems with loops step by step Beginner Free lesson, Pro answers: 20 minutes
  4. Module 4

    Functions, scope, closures and decorators

    Every kind of parameter, scope rules, lambdas and higher-order functions, closures, recursion, decorators and functools.

    1. Defining and calling functions Beginner Free lesson, Pro answers: 25 minutes
    2. Parameters: defaults, keyword-only, positional-only Beginner Free lesson, Pro answers: 20 minutes
    3. *args, **kwargs and argument unpacking Beginner Free lesson, Pro answers: 20 minutes
    4. Scope: local, enclosing, global and built-in Beginner Free lesson, Pro answers: 20 minutes
    5. Docstrings, comments and PEP 8 style Beginner Free lesson, Pro answers: 20 minutes
    6. Lambdas and higher-order functions Beginner Free lesson, Pro answers: 25 minutes
    7. Closures and the late-binding trap Intermediate Free lesson, Pro answers: 20 minutes
    8. Recursion, the call stack and its limits Intermediate Free lesson, Pro answers: 25 minutes
    9. Decorators: wrapping functions cleanly Intermediate Free lesson, Pro answers: 20 minutes
    10. functools: cache, partial, reduce and more Intermediate Free lesson, Pro answers: 25 minutes
  5. 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.

    1. Lists: create, index, slice and modify Beginner Free: 25 minutes
    2. References, aliasing, shallow and deep copies Beginner Free lesson, Pro answers: 20 minutes
    3. Sorting with key functions and stability Beginner Free lesson, Pro answers: 20 minutes
    4. Tuples, unpacking and named tuples Beginner Free lesson, Pro answers: 20 minutes
    5. Dictionaries: keys, values and views Beginner Free: 20 minutes
    6. Sets and frozensets for membership and maths Beginner Free lesson, Pro answers: 20 minutes
    7. List, dict and set comprehensions Beginner Free lesson, Pro answers: 25 minutes
    8. collections: deque, Counter, defaultdict and more Intermediate Free lesson, Pro answers: 20 minutes
    9. heapq, bisect and array for efficient data Intermediate Free lesson, Pro answers: 25 minutes
    10. Text vs bytes: Unicode, encodings, bytearray Intermediate Free lesson, Pro answers: 25 minutes
    11. Choosing the right data structure Intermediate Free lesson, Pro answers: 20 minutes
  6. 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.

    1. Modules, imports and __name__ Beginner Free lesson, Pro answers: 20 minutes
    2. Packages, __init__.py and relative imports Intermediate Free lesson, Pro answers: 20 minutes
    3. Finding and installing third-party packages Beginner Free lesson, Pro answers: 15 minutes
    4. A tour of the Python standard library Beginner Free lesson, Pro answers: 20 minutes
    5. Random numbers, simulations and statistics Beginner Free lesson, Pro answers: 25 minutes
    6. math, decimal and fractions for exact work Intermediate Free lesson, Pro answers: 20 minutes
    7. Dates, times and time zones (IST included) Intermediate Free lesson, Pro answers: 20 minutes
  7. Module 7

    Errors, exceptions and context managers

    try and except, custom exceptions, chaining and notes, exception groups, the with statement, warnings and assertions.

    1. Handling exceptions with try and except Beginner Free lesson, Pro answers: 20 minutes
    2. Raising exceptions and custom error classes Beginner Free lesson, Pro answers: 20 minutes
    3. Exception chaining, notes and tracebacks Intermediate Free lesson, Pro answers: 15 minutes
    4. Exception groups and except* Intermediate Free lesson, Pro answers: 15 minutes
    5. Context managers and the with statement Intermediate Free lesson, Pro answers: 25 minutes
    6. Warnings, assertions and development mode Intermediate Free lesson, Pro answers: 20 minutes
    7. Designing error handling for real programs Intermediate Free lesson, Pro answers: 20 minutes
  8. Module 8

    Files, paths and data formats

    Text and binary files, pathlib, CSV, JSON, configuration and secrets, archives, XML, safe serialisation and SQLite.

    1. Reading and writing text files safely Beginner Free lesson, Pro answers: 25 minutes
    2. pathlib: paths, folders and file operations Intermediate Free lesson, Pro answers: 20 minutes
    3. CSV files with the csv module Beginner Free lesson, Pro answers: 20 minutes
    4. JSON: load, dump and custom types Beginner Free lesson, Pro answers: 20 minutes
    5. Config files, environment variables and secrets Intermediate Free lesson, Pro answers: 25 minutes
    6. Binary files, struct and checksums Intermediate Free lesson, Pro answers: 25 minutes
    7. Archives and compression: zip, tar, gzip, zstd Intermediate Free lesson, Pro answers: 20 minutes
    8. XML and HTML parsing without security holes Intermediate Free lesson, Pro answers: 20 minutes
    9. pickle, shelve and safe serialisation Intermediate Free lesson, Pro answers: 25 minutes
    10. SQLite databases with sqlite3 Intermediate Free lesson, Pro answers: 20 minutes
    11. Beyond SQLite: DB-API drivers and ORMs Intermediate Free lesson, Pro answers: 20 minutes
  9. Module 9

    Object-oriented Python and the data model

    Classes and methods, properties, inheritance and composition, abstract base classes, special methods, enums and dataclasses.

    1. Classes, objects and __init__ Beginner Free lesson, Pro answers: 20 minutes
    2. Methods: instance, class, static and properties Intermediate Free core, Pro depth: 9 of 25 minutes free
    3. Encapsulation: underscores and name mangling Intermediate Free core, Pro depth: 7 of 20 minutes free
    4. Inheritance, super() and composition Intermediate Free core, Pro depth: 8 of 20 minutes free
    5. Multiple inheritance, MRO and mixins Advanced Free core, Pro depth: 9 of 25 minutes free
    6. Abstract base classes and duck typing Intermediate Free core, Pro depth: 7 of 20 minutes free
    7. Special methods: repr, str, eq and hash Intermediate Free core, Pro depth: 9 of 25 minutes free
    8. Operator overloading done right Intermediate Free core, Pro depth: 9 of 25 minutes free
    9. Custom containers: __getitem__, __iter__ and more Advanced Free core, Pro depth: 10 of 25 minutes free
    10. __slots__, weak references and object lifetime Advanced Free core, Pro depth: 7 of 20 minutes free
    11. Enums: Enum, IntEnum, StrEnum and Flag Intermediate Free core, Pro depth: 8 of 20 minutes free
    12. Dataclasses for clean data objects Intermediate Free core, Pro depth: 8 of 20 minutes free
  10. Module 10

    Iterators, generators and functional tools

    The iteration protocol, generators and pipelines, itertools, the built-in functions and a functional style in Python.

    1. How iteration works: iterables and iterators Intermediate Free lesson, Pro answers: 20 minutes
    2. Generators and generator expressions Intermediate Free core, Pro depth: 9 of 25 minutes free
    3. Generator pipelines, yield from and send Advanced Free core, Pro depth: 9 of 25 minutes free
    4. itertools: the iteration toolkit Intermediate Free core, Pro depth: 8 of 20 minutes free
    5. Built-in functions every Python coder should know Beginner Free core, Pro depth: 8 of 20 minutes free
  11. 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.

    1. Why type hints help (and what they don't do) Intermediate Free lesson, Pro answers: 15 minutes
    2. Annotating variables, functions and collections Intermediate Free core, Pro depth: 8 of 20 minutes free
    3. mypy and pyright: running type checkers Intermediate Free core, Pro depth: 6 of 15 minutes free
    4. Callable, Iterable, Sequence and type aliases Intermediate Free core, Pro depth: 8 of 20 minutes free
    5. Generics with the [T] type-parameter syntax Advanced Free core, Pro depth: 8 of 20 minutes free
    6. Protocols and structural typing Advanced Free core, Pro depth: 6 of 15 minutes free
    7. TypedDict, Literal, NewType and enums Advanced Free core, Pro depth: 8 of 20 minutes free
    8. Type narrowing, TypeIs and exhaustiveness Advanced Free core, Pro depth: 6 of 15 minutes free
    9. Overloads, ParamSpec, Self and @override Advanced Free core, Pro depth: 8 of 20 minutes free
    10. Annotations at run time with annotationlib Advanced Free core, Pro depth: 8 of 20 minutes free
    11. Typing libraries: py.typed and stub files Advanced Free core, Pro depth: 8 of 20 minutes free
    12. Validating external data at run time Advanced Free core, Pro depth: 8 of 20 minutes free
  12. Module 12

    Testing, debugging and code quality

    doctest, unittest and pytest, fixtures and mocks, property-based tests, coverage and CI, and linting and formatting.

    1. Why and how to test Python code Intermediate Free lesson, Pro answers: 20 minutes
    2. doctest: examples that test themselves Intermediate Free core, Pro depth: 8 of 20 minutes free
    3. unittest: test cases, fixtures and discovery Intermediate Free core, Pro depth: 8 of 20 minutes free
    4. Ruff and pre-commit: lint and format Python Intermediate Free core, Pro depth: 8 of 20 minutes free
  13. Module 14

    Concurrency and parallelism: threads, processes, interpreters

    The GIL, threads and synchronisation, subprocesses, multiprocessing, concurrent.futures, free-threaded builds and subinterpreters.

    1. Concurrency models and the GIL explained Intermediate Free lesson, Pro answers: 20 minutes
    2. Threads: threading and ThreadPoolExecutor Intermediate Free core, Pro depth: 9 of 24 minutes free
    3. Thread safety: locks, events and queues Advanced Free core, Pro depth: 8 of 20 minutes free
    4. Running other programs with subprocess Intermediate Free core, Pro depth: 8 of 22 minutes free
    5. Processes with multiprocessing and pools Advanced Free core, Pro depth: 9 of 25 minutes free
    6. concurrent.futures: submit, map, as_completed Advanced Free core, Pro depth: 9 of 24 minutes free
    7. Running Python without the GIL (3.14t builds) Advanced Free core, Pro depth: 9 of 24 minutes free
    8. Subinterpreters with concurrent.interpreters Advanced Free core, Pro depth: 9 of 24 minutes free
  14. 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.

    1. Async Python: the event loop mental model Intermediate Free lesson, Pro answers: 25 minutes
    2. Tasks, gather and running coroutines Intermediate Free core, Pro depth: 9 of 25 minutes free
    3. TaskGroup and structured concurrency Intermediate Free core, Pro depth: 9 of 25 minutes free
    4. Timeouts, cancellation and clean-up in asyncio Advanced Free core, Pro depth: 8 of 20 minutes free
    5. Async iterators, generators and context managers Advanced Free core, Pro depth: 7 of 20 minutes free
    6. Queues, semaphores and rate limits in asyncio Advanced Free core, Pro depth: 7 of 20 minutes free
    7. Networking with asyncio streams Advanced Free core, Pro depth: 7 of 20 minutes free
    8. Mixing blocking code with asyncio Advanced Free core, Pro depth: 7 of 20 minutes free
    9. Context variables and thread-local data Advanced Free core, Pro depth: 10 of 25 minutes free
    10. Debugging asyncio with 3.14 introspection tools Advanced Free core, Pro depth: 7 of 20 minutes free
    11. Choosing concurrency: a measured comparison Advanced Free core, Pro depth: 9 of 25 minutes free
  15. 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.

    1. Regular expressions with the re module Intermediate Free lesson, Pro answers: 25 minutes
    2. Text tools: textwrap, difflib and string Intermediate Free core, Pro depth: 8 of 20 minutes free
    3. Template strings (t-strings) in Python 3.14 Intermediate Free core, Pro depth: 8 of 20 minutes free
    4. Logging for scripts, applications and libraries Intermediate Free core, Pro depth: 8 of 20 minutes free
    5. Command-line apps with argparse Intermediate Free core, Pro depth: 8 of 20 minutes free
    6. Working with the OS: os, sys, shutil, platform Intermediate Free core, Pro depth: 8 of 20 minutes free
    7. Calling web APIs from Python with urllib Intermediate Free core, Pro depth: 9 of 25 minutes free
    8. Serving HTTP: http.server and WSGI basics Intermediate Free core, Pro depth: 7 of 20 minutes free
    9. Web scraping responsibly: robots.txt and parsing Intermediate Free core, Pro depth: 7 of 20 minutes free
    10. Socket programming basics: TCP and UDP Advanced Free core, Pro depth: 8 of 20 minutes free
    11. Automate office tasks: files, Excel, PDF, email Intermediate Free core, Pro depth: 7 of 20 minutes free
    12. Desktop GUIs with tkinter: a first app Intermediate Free core, Pro depth: 7 of 20 minutes free
    13. Secure tokens, password hashes and HMAC Advanced Free core, Pro depth: 8 of 20 minutes free
  16. 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.

    1. Measuring speed correctly with timeit Intermediate Free lesson, Pro answers: 20 minutes
    2. Profiling CPU time: cProfile and pstats Advanced Free core, Pro depth: 7 of 20 minutes free
    3. Finding memory problems with tracemalloc Advanced Free core, Pro depth: 7 of 20 minutes free
    4. Making Python code faster: proven techniques Advanced Free core, Pro depth: 6 of 20 minutes free
  17. Module 18

    Advanced Python: data model, metaprogramming and internals

    Attribute lookup, descriptors, metaclasses, introspection, the ast module, the import system and memory management.

    1. Attribute lookup and the data model Advanced Free lesson, Pro answers: 20 minutes
    2. Descriptors: how properties and methods work Advanced Free core, Pro depth: 7 of 20 minutes free
    3. Class creation: __init_subclass__ and metaclasses Advanced Free core, Pro depth: 10 of 25 minutes free
    4. Introspection: inspect, vars() and type() Advanced Free core, Pro depth: 8 of 20 minutes free
    5. The ast module: read code without running it Advanced Free core, Pro depth: 10 of 30 minutes free
    6. Inside the import system Advanced Free core, Pro depth: 7 of 20 minutes free
  18. 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.

    1. Python for coding rounds: input, output, limits Intermediate Free lesson, Pro answers: 25 minutes
    2. Time complexity of Python's built-in operations Intermediate Free intro, Pro: 4 of 20 minutes free
    3. Classic college programs written the Python way Beginner Free intro, Pro: 5 of 20 minutes free
  19. 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.

    1. NumPy first steps: arrays and vectorisation Intermediate Free lesson, Pro answers: 25 minutes
    2. Jupyter notebooks: workflow and pitfalls Intermediate Free lesson, Pro answers: 25 minutes
    3. Python for the web: WSGI, ASGI and frameworks Intermediate Free lesson, Pro answers: 25 minutes
    4. MicroPython and Python on microcontrollers Intermediate Free lesson, Pro answers: 18 minutes
    5. What to learn next: Python roadmaps Beginner Free lesson, Pro answers: 12 minutes
  20. 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.

    1. Capstone 2: a CSV data cleaner and validator Advanced Free intro, Pro: 4 of 20 minutes free
    2. Capstone 4: build a small interpreter Advanced Free intro, Pro: 4 of 25 minutes free

Related tools

Official documentation

More in Programming languages

Quick answers and tool search

Type to search tools or to get a quick answer, for example 18% of 2500. Use the up and down arrow keys to move through the results, Enter to choose, and Escape to close.