The curriculum and writing rules for this course. In Claude Code, run /new-lesson and it follows this file. With another AI, copy everything below the line and fill in Today.
You are writing one lesson of "Python from Zero", a free 30-lesson course for complete beginners. The lessons are published on a blog, one per day. Write today's lesson and its code.
- Lesson number: NN (for example 02)
- Date: YYYY-MM-DD
Write the lesson whose number matches the curriculum below. If earlier lessons are in lessons/, read them first. Build on what they taught and don't re-teach it.
- Getting Started with Python (already written)
- Variables and Data Types
- Numbers and Math
- Working with Strings
- Getting User Input and Type Conversion
- Booleans and Comparisons
- If, Elif, Else
- While Loops
- For Loops and range()
- Lists
- Tuples
- Dictionaries
- Sets
- Loop Patterns: enumerate, zip, break, continue
- Functions
- Function Arguments: defaults, keyword args, *args, **kwargs
- Scope and Return Values
- List and Dictionary Comprehensions
- Errors and Exceptions
- Reading and Writing Files
- Modules and Imports
- The Standard Library Tour: datetime, random, math, pathlib
- Virtual Environments and pip
- Classes and Objects
- Inheritance
- Dunder Methods and Dataclasses
- Working with JSON
- Calling a Web API with requests
- Testing with pytest
- Final Project: A Command-Line To-Do App
lessons/NN-short-slug.md, for examplelessons/02-variables.md.- The filename must start with the two-digit lesson number. The site uses that number to order the lessons.
- The slug may contain only lowercase letters, digits and hyphens.
code/NN-short-slug/, holding one or more runnable.pyfiles used in the lesson. The folder name must match the lesson filename.
Do not change course.json, README.md or any other lesson.
The file must begin with this frontmatter, exactly:
---
title: <Lesson title from the curriculum>
summary: <One sentence, under 120 characters, saying what the reader can do after this lesson>
date: <YYYY-MM-DD>
---Then write the body in this order, using ## headings. Never use #, because the site renders the title itself.
- Why this matters: 2–3 sentences tying the topic to something real the reader would want to build.
- The concept, step by step: 3–5 short subsections. Each one gets a small code example and a plain-English explanation of what it does.
- Common mistakes: 2–4 mistakes beginners actually make. For each, show the wrong code, the error or bad output it produces, and the fix.
- Putting it together: one complete, slightly larger example that uses everything from the lesson. It must be the same code as a file in
code/NN-slug/. - Exercise: one task the reader can finish in 10–15 minutes, with clear requirements. Add a hint. Do not include the solution.
- Recap: 3–5 bullet points.
- Code for this lesson: one closing line,
The code for this lesson is in code/NN-slug/.
- Assume the reader knows only what earlier lessons covered. If you must use something not yet taught, say so in one line: "We'll cover X in lesson N."
- Use short paragraphs and a friendly, direct tone. Address the reader as "you".
- Aim for 800–1,500 words. A lesson should take about 10 minutes to read.
- Mark every code block with a language:
python,bashortext. Show program output in a separatetextblock, labelled "Output:". - Use small, concrete examples such as a shopping list, a grade calculator or a weather report. Avoid
foo,barand abstract math. - Use plain Markdown only: headings, paragraphs, lists, code blocks, links, bold and italics. No HTML, tables, images, emojis or admonitions.
- Target Python 3.12+. Use only the standard library, except for the lessons that teach
requestsorpytest. - Every file must run as-is with
python filename.pyand produce the output shown in the lesson. - Follow PEP 8. Use descriptive names, and add a short comment only where the code isn't obvious.
- Lessons 1–14 use plain top-level scripts. From lesson 15 on, put the main logic in functions and use an
if __name__ == "__main__":guard.
Check each item:
- The frontmatter is valid and the date matches today's.
- The filename and code folder use the same
NN-slug. - Every code example is correct, and every output block matches what the code really prints.
- No concept from a later lesson is used without a note.
Then suggest a one-line commit message, in the form Add lesson NN: <Title>.