A free course, written in public

Python for Humans

Learn to code by building real-world projects right in your browser.

Free to read. A complete first draft.

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.3

Part I

Thinking in code

Python runs in the page, so there's nothing to install. Small programs that talk, decide and repeat; then small collections and the complete works of Shakespeare, where dictionaries and functions earn their keep. Finish by generating new Shakespeare with your own code.

  1. 1 Let's Write Some Python Variables & Input v0.2
  2. 2 Making Decisions If & Conditionals v0.2
  3. 3 Loops While & For Loops v0.6
  4. 4 Keeping Things Together Lists & Indexing v0.4
  5. ↳ Tic-Tac-Toe: Your Move project
  6. 5 Reading a File Text Files & Strings v0.4
  7. 6 Keeping Count Dictionaries & Key–Value Pairs v0.2
  8. 7 Giving Code a Name Functions & Return Values v0.2
  9. ↳ Tic-Tac-Toe: Three in a Row project
  10. 8 The Word-Prediction Generator Randomness & Text Generation v0.3
  11. ↳ Tic-Tac-Toe: Meet Your Opponent project
  12. ↳ Text Adventure: Explore the Castle optional project

Part II

From the REPL to programs

Turn your text experiments into reliable programs you can save, run on your own files, and share. Learn debugging, testing, files, modules, packages, public datasets, APIs and classes, with an optional branch into building a small Django web app.

  1. 9 Keeping Your Work Local Python & Saved Programs v0.1
  2. 10 Errors and debugging Tracebacks & Debugging v0.1
  3. 11 Testing Assertions & Test Cases v0.1
  4. ↳ Tic-Tac-Toe: Can You Beat It? optional project
  5. 12 Files and the filesystem Paths & File Handling v0.1
  6. ↳ Text Adventure: Save Your Adventure optional project
  7. 13 Modules and several files Imports & Reusable Code v0.1
  8. 14 Packages and uv Dependencies & API Requests v0.1
  9. 15 The web in one chapter CSV, JSON & Public Data v0.1
  10. 16 Classes Objects, Attributes & Methods v0.1
  11. ↳ Text Adventure: Meet the Castle's Characters optional project
  12. 17 The other side of the web: Django (optional) URLs, Views & Templates v0.1

Part III

Projects

Try a short project in games, websites, APIs, data exploration or machine learning. Build something small, check its behavior and choose what to explore next.

  1. 18 Choose a Project v0.1
  2. 19 Dodge the Blocks Games v0.1
  3. 20 Your Reading List Web v0.1
  4. 21 Your First API APIs & Visualization v0.2
  5. 22 Explore Real Data Data Science v0.1
  6. 23 Train Your First Model Machine Learning v0.1
  7. 24 Teach Python to Spot Spam Text Classification v0.1
  8. 25 Where Next v0.1
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.