mithiancoding

The course

Python, from zero to advanced

Forty units in four parts. Work through them in order: each unit's checkpoint opens the next one. Already know a topic? Take its checkpoint to test out.

All 40 units open 201 lessons 405 checked exercises About 55.1 hrs at a steady pace
Part 1

Foundations

From your very first line to programs that make decisions, repeat themselves and are built from functions.

Part 2

Working with data

Text, collections, files and errors: the everyday tools for programs that handle real information.

  • Use escape characters and multi-line strings
  • Check what text contains with methods like isdigit and isalpha
  • Pull structured text apart with split, strip and partition
  • Line output up in columns with format specifiers
  • Work with character codes using ord and chr
  • Work with character codes, binary, hex and bytes
  1. Special characters 18 min
  2. Checking text 17 min
  3. Pulling text apart 18 min
  4. Formatting output 15 min
  5. Codes, binary and bytes 27 min
  6. Project: Secret messagesProject 25 min
  7. Checkpoint: Strings in depth 14 min
  • Call functions with keyword arguments and avoid the mutable default trap
  • Accept any number of arguments with *args and **kwargs
  • Pass functions to other functions, including to sorted, min and max with key
  • Write small functions with lambda, and document functions with docstrings
  1. Keyword arguments and defaults 17 min
  2. Any number of arguments 16 min
  3. Functions are values 15 min
  4. Lambda and docstrings 15 min
  5. Checkpoint: More about functions 14 min
  • Import modules in the different ways Python allows
  • Use statistics, random and datetime to save writing code yourself
  • Count and group with Counter and defaultdict
  • Know where to look when you need a tool you haven't met
  • Write your own modules that also work as programs
  1. Using modules 11 min
  2. Your own modules 13 min
  3. Randomness 14 min
  4. Dates and times 15 min
  5. Handy collections 15 min
  6. Checkpoint: The standard library 14 min
  • Read a multi-line traceback and find the line that matters
  • Find bugs with print statements, tracing and small test cases
  • Recognise the most common bugs on sight
  • Break a problem into small functions and build it step by step
  1. Reading a traceback 9 min
  2. Finding bugs 19 min
  3. The usual suspects 14 min
  4. Planning a program 14 min
  5. Project: Text analyserProject 22 min
  6. Checkpoint: Problem solving 14 min
Part 3

Building bigger programs

Objects, recursion, algorithms and testing: how working programmers organise code that keeps growing.

  • Control how objects print with __str__ and __repr__
  • Make objects work with ==, <, len and + using special methods
  • Build a class on top of another with inheritance and super()
  • Treat different kinds of object the same way, and know when to use composition instead
  • Use class attributes, properties and class methods
  1. Printing objects 10 min
  2. Making objects feel built in 17 min
  3. Inheritance 15 min
  4. Same question, different answers 10 min
  5. Class attributes and properties 22 min
  6. Checkpoint: Inheritance and special methods 14 min
  • Write a recursive function with a base case and a recursive case
  • Explain the call stack, and why missing base cases cause RecursionError
  • Solve problems on nested data that loops struggle with
  • Decide when recursion is clearer than a loop, and when it isn't
  1. Functions that call themselves 17 min
  2. The call stack 10 min
  3. Recursion on nested data 21 min
  4. When to use recursion 5 min
  5. Checkpoint: Recursion 14 min
  • Use a stack for last-in, first-out problems like matching brackets and undo
  • Use a queue, with collections.deque, for first-in, first-out problems
  • Build a linked list from nodes, and walk, add to and search it
  • Choose a structure by the operations a problem needs
  • Explain how hash tables make dictionaries and sets fast
  1. Stacks 20 min
  2. Queues 15 min
  3. Linked lists 17 min
  4. Hash tables 21 min
  5. Checkpoint: Stacks, queues and linked lists 14 min
  • Turn a description into a design: which classes, what they know, what they do
  • Build a program with several cooperating classes, one step at a time
  • Define your own exception type for errors that belong to your program
  • Protect the finished program with tests
  1. Designing before building 5 min
  2. Project: Build the libraryProject 33 min
  3. Protecting it with tests 8 min
  4. Checkpoint: Part 3 14 min
Part 4

Advanced Python

Decorators, data structures, dynamic programming and clean design, ending with a capstone and life beyond the browser.

  • Add type hints to variables, parameters and return values
  • Read hints for lists, dictionaries, optional values and unions
  • Define data classes with defaults, ordering and immutability
  • Use enums for fixed sets of named values
  • Handle different forms of data with match and case
  1. Type hints 13 min
  2. Data classes 21 min
  3. Enums 8 min
  4. Pattern matching 22 min
  5. Checkpoint: Type hints and dataclasses 14 min
  • Convert between Python data and JSON text, and read and write JSON files
  • Navigate and reshape nested data like the responses web services send
  • Create a SQLite database and insert, query, sort and filter rows
  • Summarise and combine tables with GROUP BY and JOIN, using parameters safely
  1. JSON 15 min
  2. Nested data 14 min
  3. SQL databases 17 min
  4. Summaries, joins and safety 18 min
  5. Checkpoint: Working with data 14 min