Skip to content
aviral gupta

// LEARN · LANGUAGES & FRAMEWORKS

Python

A practical Python course from installing Python to typing, concurrency and publishing a package. Every example is run and checked against Python 3.14.

Level: Beginner to advanced · For: Anyone who wants to program in Python, from a first script to production code. No experience needed.

Syllabus

Beginner

Complete

After this level you can

  • Install Python 3.14, run a script and use the interactive interpreter
  • Write programs with variables, numbers, strings, lists, conditions, loops and match
  • Define and call functions with default, keyword, positional-only and keyword-only parameters
  • Choose between list, tuple, set and dict, and explain names versus objects, copies and the mutable-default trap
  • Split code into modules, read and write text and JSON files, and handle the common exceptions
  1. B1First steps5 of 5 written · 5 lessonsBrowser and your computer

    Install Python, use the REPL as a calculator, work with numbers, text and lists, and write a first loop

    You build: A tip calculator

    1. B1.1Install Python and run your first script
    2. B1.2Numbers: Python as a calculator
    3. B1.3Text: strings, indexing and slicing
    4. B1.4Lists: store and change a sequence
    5. B1.5First program: variables, a while loop and a tip calculator
  2. B2Control flow5 of 5 written · 5 lessonsRuns in your browser

    Branch with if and match, and loop with for, range, while, break, continue and else on loops

    You build: FizzBuzz variants and a menu with match

    1. B2.1Decisions with if, elif and else
    2. B2.2for loops and range()
    3. B2.3break, continue, pass and else on loops
    4. B2.4Pattern matching with match
    5. B2.5Build: FizzBuzz variants and a menu with match
  3. B3Functions5 of 5 written · 5 lessonsRuns in your browser

    Define functions with defaults, keyword and special parameters, *args and **kwargs, lambdas, docstrings and annotations

    You build: A unit converter library

    1. B3.1Defining functions and returning values
    2. B3.2Default values and keyword arguments
    3. B3.3Positional-only, keyword-only, *args and **kwargs
    4. B3.4Lambdas, docstrings, annotations and PEP 8
    5. B3.5Build: a unit converter library
  4. B4Data structures6 of 6 written · 6 lessonsRuns in your browser

    Use lists, deques, comprehensions, tuples, sets and dicts, and know when two names share one object

    You build: A word-frequency counter

    1. B4.1List methods, stacks and queues
    2. B4.2List comprehensions
    3. B4.3Tuples and unpacking
    4. B4.4Sets
    5. B4.5Dictionaries and looping techniques
    6. B4.6References, copies and the mutable default trap
  5. B5Modules, files and errors5 of 5 written · 5 lessonsRuns in your browser

    Import and write modules, format with f-strings, read and write files and JSON, and handle and raise exceptions

    You build: A JSON to-do file manager

    1. B5.1Modules and imports
    2. B5.2Formatted output with f-strings
    3. B5.3Reading and writing files
    4. B5.4Saving structured data with JSON
    5. B5.5Handling exceptions

Beginner project

Expense tracker

Add, list and summarise expenses by category and month, stored in a JSON file, with tests for a missing and a corrupt file.

Runs in your browserSelf-checked against a rubric

Open the project guide

Intermediate

Complete

After this level you can

  • Design error handling with custom exceptions, chaining, finally, context managers and exception groups
  • Model a domain with classes, inheritance, dataclasses and enum, and explain scopes and namespaces
  • Write iterators and generators, and use itertools, functools and collections idiomatically
  • Build a command-line tool with argparse, pathlib, re, datetime, csv and logging
  • Test with unittest, unittest.mock and doctest, and manage a project with venv, pip and pyproject.toml
  1. I1Errors in depth5 of 5 written · 5 lessonsRuns in your browser

    Chain exceptions, write custom ones, clean up with finally and with, and handle exception groups

    You build: A retrying file reader

    1. I1.1Raising and defining your own exceptions
    2. I1.2Exception chaining
    3. I1.3Clean-up with finally and with
    4. I1.4Exception groups and notes
    5. I1.5Build: a retrying file reader with contextlib
  2. I2Classes6 of 6 written · 6 lessonsRuns in your browser

    Use scopes, classes, inheritance and the MRO, private names, dataclasses and enum

    You build: A bank-account model with dataclasses

    1. I2.1Scopes and namespaces
    2. I2.2Classes and instances
    3. I2.3Inheritance and the MRO
    4. I2.4Private names and properties
    5. I2.5Data classes
    6. I2.6Build: enums and a bank-account model
  3. I3Iteration and functional tools6 of 6 written · 6 lessonsRuns in your browser

    Write iterators and generators, and use itertools, functools and collections

    You build: A lazy CSV pipeline

    1. I3.1The iterator protocol
    2. I3.2Generators
    3. I3.3Generator expressions and lazy evaluation
    4. I3.4itertools
    5. I3.5functools and decorators
    6. I3.6Build: a lazy CSV report with collections
  4. I4The standard library for real programs6 of 6 written · 6 lessonsBrowser and your computer

    Use pathlib, argparse, sys, re, datetime, csv and logging in a real program

    You build: A command-line log grep

    1. I4.1Files and folders with pathlib
    2. I4.2Command-line programs with argparse and sys
    3. I4.3Regular expressions with re
    4. I4.4Dates and times with datetime
    5. I4.5CSV files
    6. I4.6Logging, and building a log grep
  5. I5Testing and project tooling5 of 5 written · 5 lessonsBrowser and your computer

    Test with unittest, mock and doctest, and set up a project with venv, pip and pyproject.toml

    You build: A tested, installable package skeleton

    1. I5.1Testing with unittest
    2. I5.2Test doubles with unittest.mock
    3. I5.3doctest and what to test
    4. I5.4Virtual environments and pip
    5. I5.5pyproject.toml and an installable package

Intermediate project

Log analyser

A command-line tool that parses log files, aggregates them, writes CSV or JSON, logs its progress and installs as a console script.

Runs on your computerSelf-checked against a rubric

Open the project guide

Advanced

Complete

After this level you can

  • Implement Python protocols through special methods and descriptors, and control attribute access and class creation
  • Type a codebase with generics, Protocol, TypedDict and overloads, and check it with mypy
  • Choose between threads, processes and asyncio for a workload, and write structured async code
  • Measure and improve performance, and handle floating-point and decimal arithmetic correctly
  • Use template strings and tomllib, avoid the common security pitfalls and publish a package
  1. A1The data model6 of 6 written · 6 lessonsRuns in your browser

    Implement special methods, operators, container and context protocols, descriptors and metaclasses

    You build: A Vector and Matrix type with operators

    1. A1.1__repr__, __str__, __eq__ and __hash__
    2. A1.2Operator overloading
    3. A1.3Container protocols
    4. A1.4Writing context managers
    5. A1.5Descriptors and properties
    6. A1.6Build: attribute hooks, class creation, Vector and Matrix
  2. A2Typing6 of 6 written · 6 lessonsBrowser and your computer

    Type code with generics, Protocol, TypedDict, Literal and overloads, and read annotations at runtime

    You build: Typing an untyped module until mypy is clean

    1. A2.1Type hints and a type checker
    2. A2.2Generics with the PEP 695 syntax
    3. A2.3Structural typing with Protocol
    4. A2.4TypedDict, Literal and Final
    5. A2.5Overloads and type narrowing
    6. A2.6Annotations at runtime in 3.14
  3. A3Concurrency6 of 6 written · 6 lessonsRuns on your computer

    Choose between threads, processes and asyncio, and use TaskGroup and timeouts

    You build: A concurrent file hasher compared across the three models

    1. A3.1Threads, locks and the GIL
    2. A3.2Processes with multiprocessing
    3. A3.3concurrent.futures
    4. A3.4asyncio: coroutines and tasks
    5. A3.5TaskGroup, timeouts and cancellation
    6. A3.6Choosing a concurrency model
  4. A4Performance and numbers5 of 5 written · 5 lessonsBrowser and your computer

    Measure with timeit and cProfile, and handle floats, decimal and weak references

    You build: Making a slow report ten times faster, measured

    1. A4.1Measuring with timeit
    2. A4.2Profiling with cProfile
    3. A4.3The cost of data-structure choices
    4. A4.4Floating point, decimal and fractions
    5. A4.5Weak references and a ten times faster report
  5. A5Modern Python and safe code5 of 5 written · 5 lessonsBrowser and your computer

    Use template strings, tomllib and sqlite3 safely, avoid eval, pickle and shell=True, and publish a package

    You build: A safe report generator using template strings

    1. A5.1Template strings (t-strings)
    2. A5.2Reading configuration with tomllib
    3. A5.3sqlite3 and parameterised queries
    4. A5.4eval, pickle and shell=True
    5. A5.5Secrets, hashing and publishing

Advanced project

Async job runner

An asyncio runner with TaskGroup, per-job timeouts, retries with backoff and cancellation, fully typed and profiled.

Runs on your computerSelf-checked against a rubric

Open the project guide

Capstone

Capstone

Personal library manager

An installable package with a command line, a typed domain model, sqlite3 storage, TOML configuration, logging and a test suite.

Runs on your computerSelf-checked against a rubric

Open the project guide

Sources