The whole course
28 lessons across seven days, each with a Python editor you can run and change. Start at Day 1 or jump to whatever you need.
0" @input.debounce.250ms="search()" @keydown.enter.prevent="searchFromButton()" placeholder="Search the lessons..." class="w-full bg-transparent px-5 py-3 text-[var(--sgkb-text-tertiary)] font-normal placeholder:text-[var(--sgkb-text-tertiary)] placeholder:font-normal placeholder:opacity-100 outline-none font-['Poppins']" style="font-size: var(--text-sm); line-height: var(--text-sm--line-height);">
1
Foundations Day 1 · 4 lessons · About 90 minutes
Print, variables, strings, and talking to the user.
Day overview- 1.1 Hello, Python Run your first Python program, print things to the screen, and leave notes for your future self.
- 1.2 Variables & Numbers Give values names, do arithmetic that behaves, and learn why 0.1 + 0.2 is not 0.3.
- 1.3 Strings & f-strings Build, slice and format text — the data type you will handle more than any other.
- 1.4 Input & Types Ask the user a question, convert what comes back, and understand why input() always hands you a string.
2
Logic & Loops Day 2 · 4 lessons · About 2 hours
Decisions with if, repetition with while and for.
Day overview- 2.1 Booleans & Comparisons True, False, and the operators that produce them — the raw material of every decision your code makes.
- 2.2 if / elif / else Branching, indentation as syntax, and how to keep a chain of conditions readable.
- 2.3 while Loops Repeat while something stays true — counters, accumulators, validation loops, and how to avoid an infinite one.
- 2.4 for Loops & range() Walk through a sequence item by item — the loop you will write ten times more often than while.
- 3.1 Lists Ordered, changeable collections — how to build them, index them, slice them, sort them, and copy them safely.
- 3.2 Tuples & Unpacking Fixed collections, multiple return values, and the assignment trick that makes Python code look like Python.
- 3.3 Dictionaries Look values up by name instead of position — the collection behind configuration, JSON, counting and caching.
- 3.4 Sets & Choosing a Collection Unique items, fast membership tests, set arithmetic — and a decision table for picking the right container.
- 4.1 Defining Functions Wrap behaviour in a name, hand it inputs, get a value back — and learn why returning beats printing.
- 4.2 Arguments in Depth Positional and keyword arguments, *args and **kwargs, and how mutable arguments can surprise you.
- 4.3 Scope & Lambdas Where names live, why functions cannot see each other's variables, and the one-line functions you pass to sort().
- 4.4 Comprehensions Transform and filter a collection in one readable line — the construct that makes Python look like Python.
5
Errors, Files & Modules Day 5 · 4 lessons · About 2 hours
Handling failure and reaching for the standard library.
Day overview- 5.1 Errors & Exceptions Read a traceback, catch what you can handle, raise what you cannot, and stop writing except: pass.
- 5.2 Reading & Writing Files Open files safely with with, read them line by line, write results back, and handle CSV without heroics.
- 5.3 Modules & the Standard Library Import code that already exists — math, random, datetime, collections, pathlib — and write your own module.
- 5.4 Python on Your Own Machine Leaving the browser: installing Python, running .py files, virtual environments, and pip.
6
Objects & Classes Day 6 · 4 lessons · About 2 hours
Bundling data with the behaviour that belongs to it.
Day overview- 6.1 Classes & Objects Define your own types: __init__, attributes, methods, and the difference between a class and an instance.
- 6.2 Dunder Methods Teach your objects to print, compare, add, and work with len() — by implementing the methods Python already looks for.
- 6.3 Inheritance & Composition Share behaviour between classes — and learn why 'has a' usually beats 'is a'.
- 6.4 Dataclasses & Type Hints Let Python write the boilerplate, and annotate your code so tools and readers know what goes where.
7
Putting It Together Day 7 · 4 lessons · About 2.5 hours
Generators, multi-file projects, tests, and a capstone.
Day overview- 7.1 Iterators & Generators Produce values one at a time with yield — the idea behind for loops, file reading, and pipelines that never run out of memory.
- 7.2 Multi-File Projects Split a program across modules and packages, with imports that behave and a main entry point.
- 7.3 Testing Your Code assert, unittest and pytest — how to know your program still works after you change it.
- 7.4 Capstone: Build Something A complete program that uses everything from the week — and a map of where to go next.
Prefer to poke at it yourself?
The playground is a blank Python editor with nothing around it — useful for testing an idea from any lesson.
Open the playground