Python · Learn

The Python curriculum

A general-purpose language known for clear syntax and a huge standard library. The usual first language for data work, automation and backend services. This path has 18 lessons in reading order, from the basics to the ideas that come up in real code, with a runnable example in every lesson.

lessons
17 lessons
hours of reading
2.4 hours of reading
exercises to practise
9 exercises to practise

Beginner

9 lessons · about 80 minutes of reading, plus practice.

  1. Python Syntax and Your First ProgramHow a Python program is laid out: statements, indentation, comments, print() and input(), shown through a first runnable program you can change.8 min
  2. Variables in PythonHow Python variables work: assignment binds a name to a value, no type declaration is needed, and a variable is a label rather than a box. Runnable examples.7 min
  3. Data Types in PythonThe core Python data types int, float, str, bool and None: how to check a type with type() and convert between types with int(), float() and str().8 min
  4. Operators in PythonPython's arithmetic, comparison, logical, assignment and membership operators, with the precedence rules and the difference between /, // and %.8 min
  5. Conditions: if, elif and else in PythonHow Python chooses between paths with if, elif and else, how truthiness works, why branch order matters, and how to write conditions that stay readable.8 min
  6. Loops in Python: for and whileHow a for loop walks through a sequence and a while loop repeats until a condition fails, with range(), enumerate(), break and continue explained by example.9 min
  7. Functions in PythonHow to define and call Python functions with def, pass arguments, return results, use default and keyword arguments, and why variables inside are local.9 min
  8. Strings in PythonWorking with text in Python: indexing and slicing strings, methods such as strip(), split(), replace() and join(), and formatting output with f-strings.9 min
  9. Lists in PythonHow Python lists store ordered, changeable collections: creating them, indexing and slicing, adding and removing items, sorting, copying and looping over them.9 min

Intermediate

8 lessons · about 70 minutes of reading, plus practice.

  1. Tuples in PythonHow Python tuples work: building fixed records, unpacking values into names, returning several results from a function and using tuples as dictionary keys.8 min
  2. Sets in PythonHow Python sets store unique, unordered items: removing duplicates, fast membership tests, union, intersection and difference, and why set order is unreliable.8 min
  3. Dictionaries in PythonHow Python dictionaries map keys to values: creating and updating entries, safe lookup with get, iterating items in insertion order, counting and grouping.9 min
  4. Comprehensions in PythonHow list, dict and set comprehensions build a collection in one expression, with filters, transformations and nested loops, and when a loop is clearer.8 min
  5. Modules and Imports in PythonWhat a Python module is, the three forms of import, where Python looks for modules, how __name__ works, and how your own .py file becomes importable.9 min
  6. Reading and Writing Files in PythonHow to read and write text files in Python with open and with: file modes, reading line by line, appending, explicit encodings, and pathlib for paths.9 min
  7. Exceptions and Error Handling in PythonHow Python exceptions work: catching specific errors with try/except, using else and finally, raising your own, and defining custom exception classes.10 min
  8. Inheritance in PythonHow Python inheritance lets a subclass reuse and extend a parent class: super().__init__, overriding, isinstance, the MRO and when composition is better.10 min