Everwhy Open Everwhy
Computing

What does it take to go from short scripts to programs you can trust?

Python 201 · about 12 minutes a level

The second Python class: richer data structures, comprehensions and smarter loops, functions in depth, handling errors, reading and writing files and JSON, modules and the standard library, classes and objects, and testing your code. Every lesson teaches by reading small programs and predicting exactly what they do.

Open in Everwhy Continue on the web

Go deeper, level by level

  1. More data structures: Tuples and unpacking, Sets: unique values and fast membership, Nested data: lists of dictionaries and more
  2. Comprehensions and smarter loops: List comprehensions, Dictionary and set comprehensions, Looping with enumerate and zip, Sorting with key functions and lambda
  3. Functions in depth: Default values and keyword arguments, Any number of arguments: *args and **kwargs, Functions as values: closures, map and filter, Recursion
  4. Errors and exceptions: Catching errors with try and except, else, finally and cleaning up, Raising your own exceptions
  5. Files and data: Reading and writing text files, Working with CSV files, JSON: saving data and reading it back, Paths and folders with pathlib
  6. Modules and the standard library: Modules and imports, Batteries included: math, random, datetime and collections, Installing packages: pip and virtual environments
  7. Classes and objects: Classes and objects, Methods and special methods, Inheritance and super(), Data classes for simple records
  8. Reliable code: Testing with pytest, Debugging and logging, Type hints and readable style, Project: a word statistics tool

Every lesson shows its sources and how sure we are, and is checked by Everwhy.