Pylerno
English

13 chapters / 96 lessons

The Python handbook

Write your first line of Python, then build a program you can test and share. Each lesson pairs a worked example with a question that helps you explain the result.

Trace a running total
total = 0
for price in [4, 7, 2]:
    total += price
print(total)
Steppricetotal
0144
02711
03213

Curriculum

01Getting startedInstall Python and run your first script from a terminal.6 lessons
  1. Introduction
  2. Installation and setup
  3. Windows installation
  4. macOS installation
  5. Linux installation
  6. Your first local project
02FoundationsCalculate a total, name the result, and format it for a reader.11 lessons
  1. Your first program
  2. Syntax and indentation
  3. Variables
  4. Types and conversion
  5. Input and output
  6. Arithmetic
  7. Boolean logic
  8. Strings
  9. Indexing and slicing
  10. Text methods
  11. String formatting
03Control flowChoose a branch and trace a loop from its first pass to its last.6 lessons
  1. Conditional statements
  2. Pattern matching
  3. For loops
  4. While loops
  5. Loop control
  6. Nested loops
04Data structuresChoose a collection that preserves the information your program needs.10 lessons
  1. Lists
  2. List operations
  3. Tuples
  4. Sets
  5. Dictionaries
  6. Dictionary patterns
  7. Nested data
  8. References and copying
  9. Iteration helpers
  10. Comprehensions
05FunctionsMove repeated work into functions with explicit inputs and results.6 lessons
  1. Defining functions
  2. Parameters and defaults
  3. Flexible arguments
  4. Scope
  5. Pure functions
  6. Functions as values
06Object-oriented PythonGive related data and behavior a home in a class.3 lessons
  1. Classes and instances
  2. Data classes
  3. Composition and inheritance
07Reliable codeFind the cause of a failure and write a test that catches it.5 lessons
  1. Exceptions
  2. Validation
  3. Debugging
  4. Type hints
  5. Testing basics
08Files and projectsOrganize modules and read structured records from disk.10 lessons
  1. Modules and imports
  2. The main guard
  3. Virtual environments
  4. Project configuration
  5. Paths
  6. Text files
  7. Bytes and encoding
  8. JSON
  9. CSV
  10. Dates and times
09Intermediate PythonBuild iterators and context managers, then explain when they run.9 lessons
  1. Algorithms
  2. Regular expressions
  3. Iterators
  4. Generators
  5. Collections and itertools
  6. Decorators
  7. Context managers
  8. Recursion
  9. Numbers and randomness
10Developer workflowTest a project, work with a database, and measure performance.10 lessons
  1. Pytest
  2. Linting and type checking
  3. Git workflow
  4. Logging
  5. HTTP and JSON
  6. SQLite
  7. Asynchronous Python
  8. Profiling and caching
  9. Subprocess arguments
  10. Command-line interfaces
11Guided projectsBuild working tools, from a calculator to a persistent task manager.5 lessons
  1. Calculator
  2. Grade report
  3. Word analyzer
  4. Expense reports
  5. TaskFlow capstone
12Professional practicePackage an application and verify a release against existing data.5 lessons
  1. Package a command-line application
  2. Test a complete command
  3. Run checks on every change
  4. Design a transaction and test its rollback
  5. Release and maintain a Python package
13Advanced language and runtimeReason about object identity, concurrency, typing, and representation.10 lessons
  1. Inheritance and method resolution
  2. Descriptors and attribute lookup
  3. Structural typing with protocols
  4. Task groups and cancellation
  5. Generics and relationships between types
  6. Threads, shared state, and locks
  7. Object lifetime and weak references
  8. Equality, hashing, and dictionary keys
  9. Unicode text and normalization
  10. Decimal arithmetic and rounding policy

Search documentation

Share this page