Functions let you name a piece of logic and reuse it forever. Recursion lets functions call themselves. Together, they're how real software is built.
Package logic into reusable def blocks with docstrings.
Pass data in and get results back — the function contract.
Local vs global, why variables inside functions stay inside.
Write functions that take lists/dicts and return results.
Functions that call themselves — base case + recursive case.
Assemble a reusable utility module — your final project.
Hover over each line to see its role.
6 lessons — the biggest unit yet! Click any to see challenges.
Write your first functions with def, understand return vs print(), and DRY.
Default values, multiple returns with tuples, and None.
Local vs global, shadowing, and the LEGB rule.
Pass lists and dicts to functions, return collections, build a toolkit.
Base cases, recursive cases, call stack, and factorial.
Recursive strings, palindromes, call trees, and list flattening.
Build a utility module: 8+ functions including list processing, dict processing, and recursion.
Functions are the most important concept in programming. Let's master them.
Begin Lesson 5.1 →