A free book, written in public

Python for Humans

Learn to code by hand, at human pace, with Python running right beside the page.

Free to read. Nothing to install until chapter 11. 2 of 24 chapters posted so far.

Try it now. Click below, type your name in quotes, and press Enter:name = 'Ada'

Contents

Chapters go up here as they're written. Each post is a draft, with its version and date on the page.

Introduction draft v0.1

Part I

Thinking in code

Python runs in the page, so there's nothing to install. Strings, lists, loops, dictionaries and functions, all on the complete works of Shakespeare.

  1. 1 Getting started coming
  2. 2 Variables, print, input coming
  3. 3 Types coming
  4. 4 Reading a File v0.1
  5. 5 Lists coming
  6. 6 Loops coming
  7. 7 Conditionals coming
  8. 8 Dictionaries coming
  9. 9 Functions coming
  10. 10 Under the hood coming

Part II

From the REPL to programs

Install Python and write programs you keep. Errors, tests, files, modules, packages, the web from both sides, and classes.

  1. 11 Keeping your work coming
  2. 12 Errors and debugging coming
  3. 13 Testing coming
  4. 14 Files and the filesystem coming
  5. 15 Modules and several files coming
  6. 16 Packages and uv coming
  7. 17 The web in one chapter coming
  8. 18 Classes coming
  9. 19 The other side of the web coming

Part III

Capstones

Write a program that writes new Shakespeare, a crude ancestor of the language models. Then find and fix the bugs in code someone else wrote.

  1. 20 The word-prediction generator coming
  2. 21 Capstone menu coming

Part IV

Coding with AI, as a human

Work with an AI as the person in charge, and where to go next.

  1. 22 Working with an AI, as a human coming
  2. 23 Where next coming
Will Vincent

Who am I?

Hi, I'm Will Vincent. I'm a Python Software Foundation Fellow, a former board member of the Django Software Foundation, author of Django for Beginners, and co-host of the Django Chat podcast.

I've taught Python and web development to thousands of developers through my books, tutorials and courses. I believe in learning the fundamentals properly: understanding how code works, not just copying what an AI suggests.