Skip to content
All paths
BeginnerFoundations

Python Programming from Zero

Start with no programming experience and finish writing tested, well-structured Python programs that read files, call APIs and automate real tasks. Every module ends with something you can run.

What you will be able to do

  • Write clear Python programs with functions, loops and the core data structures
  • Organise code into modules and packages and manage dependencies with venv and pip
  • Model problems with classes and dataclasses
  • Read and write files, CSV and JSON, and call web APIs
  • Test, debug and version your code with pytest and Git

Roadmap

Bar length shows each module's share of study time.

  1. 1

    Getting started

    Install Python and write your first programs.

    8h3 topics
    Not started
    Show topics
  2. 2

    Control flow & functions

    Make decisions, repeat work and name it.

    12h5 topics
    Not started
    Show topics
    • Write if/elif/else branches with combined conditions and no redundant checks.

      • Write if/elif/else branches
      • Combine conditions with and, or, not
      • Compare values and check membership
      • Simplify redundant checks
    • Loop over sequences and ranges and stop or skip at the right moment.

      • Loop over lists and strings with for
      • Generate numbers with range()
      • Write while loops with clear exit conditions
      • Use break and continue correctly
      • Iterate with enumerate() and zip()
    • Split a program into small functions with default and keyword arguments.

      • Define functions with def and return
      • Use default and keyword arguments
      • Accept *args and **kwargs
      • Write docstrings for your functions
      • Refactor a script into small functions
    • Predict which variable a name refers to and avoid hidden global state.

      • Trace local vs global scope
      • Understand None as a return value
      • Avoid mutating global state
      • Rewrite a function to be pure
    • Replace long if/elif chains with readable match statements where they fit.

      • Write a basic match/case statement
      • Match on literals, tuples and classes
      • Refactor an if/elif chain to match
  3. 3

    Core data structures

    Lists, dicts and friends: most of everyday Python.

    16h5 topics
    Not started
    Show topics
    • Store, slice, sort and unpack sequences confidently.

      • Create, index and slice lists
      • Append, insert and remove items
      • Sort with sorted() and key functions
      • Pack and unpack tuples
      • Choose tuples for fixed records
    • Count, group and look up data with dicts and remove duplicates with sets.

      • Create, read and update dicts
      • Iterate over keys, values and items
      • Count and group data with dicts
      • Use sets to remove duplicates
      • Apply set union and intersection
    • Turn simple build-a-list loops into list, dict and set comprehensions.

      • Write list comprehensions with conditions
      • Build dicts with dict comprehensions
      • Build sets with set comprehensions
      • Know when a plain loop is clearer
    • Explain why changing one list changed another and fix it with copies.

      • Tell mutable from immutable types
      • See aliasing with two names, one list
      • Make shallow and deep copies
      • Avoid mutable default arguments
    • Solve ten beginner exercises combining loops, lists and dicts without help.

      • Solve list filtering exercises
      • Solve counting and grouping exercises
      • Solve string processing exercises
      • Check solutions against edge cases
      • Finish ten exercises without help
  4. 4

    Files, errors & modules

    Programs that survive real input and grow beyond one file.

    10h4 topics
    Not started
    Show topics
  5. 5

    Object-oriented Python

    Bundle data and behaviour when it helps.

    10h3 topics
    Not started
    Show topics
    • Design a class with an initialiser, attributes and methods for a small domain.

      • Define a class with __init__
      • Add attributes and methods
      • Create and use several instances
      • Use class vs instance attributes
      • Model a small domain with classes
    • Use __repr__, __eq__ and friends and choose composition over deep hierarchies.

      • Subclass and override methods
      • Call parent methods with super()
      • Implement __repr__ and __eq__
      • Prefer composition for has-a relationships
      • Refactor a deep hierarchy to composition
    • Replace boilerplate classes with dataclasses and magic strings with enums.

      • Convert a class to a dataclass
      • Use defaults, frozen and field()
      • Define an Enum for fixed choices
      • Replace magic strings with enums
    Module resources:Classes tutorial ↗
  6. 6

    Idiomatic Python & the standard library

    Write Python that looks like Python.

    12h4 topics
    Not started
    Show topics
    • Reach for Counter, defaultdict, itertools and datetime instead of reinventing them.

      • Count items with Counter
      • Group data with defaultdict
      • Chain and group with itertools
      • Parse and format dates with datetime
      • Generate random samples with random
    • Write generators that process large data lazily.

      • Understand the iterator protocol
      • Write generator functions with yield
      • Use generator expressions
      • Process a large file lazily
    • Read and write simple decorators and custom with-blocks.

      • Write a simple timing decorator
      • Use functools.wraps correctly
      • Write a context manager class
      • Use contextlib.contextmanager
    • Annotate functions and classes so editors and type checkers catch mistakes.

      • Annotate function parameters and returns
      • Use list, dict and Optional hints
      • Type a dataclass
      • Run mypy or Pyright on a project
  7. 7

    Testing, debugging & Git

    The habits that make code trustworthy.

    10h4 topics
    Not started
    Show topics
  8. 8

    Practical Python

    Point your skills at real-world tasks.

    12h4 topics
    Not started
    Show topics
  9. 9

    Capstone project

    One complete program you built yourself.

    12h2 topics
    Not started
    Show topics