Functions
Name a group of steps and reuse it: parameters, defaults, *args and **kwargs, scope, closures, recursion, type hints, and how to design a good function.
A function is a named group of steps that you can run again and again with different inputs. Until now every program in this course was a list of statements. From this phase on, your programs are built from small, named, reusable pieces, which is how every real Python program is written.
You will learn how to define and call functions, how Python matches arguments to parameters (positional, keyword, default, variadic, keyword-only and positional-only), which names a function can see (scope), and why Python lets you treat a function as a value you can pass around, store in a dictionary, or return from another function. That last idea powers closures, sorting with a key, and the tool systems that let AI models call your code.
The phase ends with recursion (a function that calls itself), a first look at docstrings and type hints, and the design habits that make functions easy to read, test and trust. Every later phase assumes you are comfortable here.
Practise this phase
Hands-on exercises: write the code, run it, and press Check to have it tested automatically.