TetSharing

Python tutorial

Readable, batteries-included language for scripts, data work and automation. 22 short chapters, one idea each, every example runnable in the page.

Who it's for: Absolute beginners, students, and anyone who wants a first language that reads almost like English.

Prerequisites: None. You only need a browser; every lesson has a Run button. Installing Python locally is optional.

Start with chapter 1 →

An open laptop displaying a code editor with a dark theme
Photo: clark_fransa on Unsplash

How this Python track is organized

The first eight chapters cover the core of the language: running a program, how indentation shapes code, names and values, numbers, text, formatting and decisions. Chapters 9 to 14 introduce the four built-in collections (lists, tuples, dictionaries, sets) and the two loops that walk through them. The rest of the track turns repeated code into functions, handles errors, reuses code through modules, reads and writes files, and ends with classes.

Each chapter assumes only the chapters before it. If you already know another language, skim the summaries at the end of each page and stop where something looks unfamiliar.

All examples are tested on Python 3.9 and also run in your browser on Pyodide, which ships Python 3.12. Where a newer feature such as match exists, the chapter says which version introduced it.

All 22 chapters

  1. 01Get started
  2. 02Syntax and comments
  3. 03Variables
  4. 04Numbers and math
  5. 05Strings
  6. 06f-strings and formatting
  7. 07Booleans and logic
  8. 08if, elif, else
  9. 09Lists
  10. 10Tuples
  11. 11Dictionaries
  12. 12Sets
  13. 13for loops and range()
  14. 14while, break, continue
  15. 15Functions
  16. 16Default and keyword arguments
  17. 17Lambda and sorting keys
  18. 18List comprehensions
  19. 19Errors and exceptions
  20. 20Modules and imports
  21. 21Reading and writing files
  22. 22Classes and objects

Practice and reference

Final Python quiz (22 questions)Cheat sheet: python string methodsCheat sheet: python lists dictsOfficial Python documentation