Skip to content

Python Programming Textbook

A free, self-paced textbook in 7 chapters. Read a chapter, then drill it with the 50 companion flashcards using spaced repetition.

7 chapters · 50 cards · Updated

Chapters

  1. 1Introduction to Python

    Python is a high-level, interpreted programming language renowned for its readability and simplicity. Created by Guido van Rossum with the first version released in 1991, Python wa...

  2. 2Variables, Types, and Operators

    Variables in Python are names that reference objects storing data. They are created automatically on first assignment, as in x = 5, and because Python uses dynamic typing, the type...

  3. 3Control Flow

    Python's control flow begins with the if statement, written as if condition: followed by an indented block. The condition is evaluated for truthiness; in Python, non-empty and non-...

  4. 4Functions

    Functions are defined using the def keyword, followed by the function name, parameters in parentheses, and a colon, as in def function_name(parameters):. The indented body contains...

  5. 5Data Structures

    Lists are mutable, ordered sequences defined with square brackets, such as mylist = [1, 2, 3]. You access elements by index using mylist[0] for the first element, and negative indi...

  6. 6Object-Oriented Programming

    Python supports object-oriented programming through classes. You define a class with the class keyword, like class MyClass:, followed by indented methods. Instances are created by...

  7. 7Modules, Exceptions, and Advanced Features

    Python's modular system allows you to organize and reuse code across files and projects. You can import a module with import module and access its functions as module.func, or brin...

← Back to the Python Programming deck