Functions¶
What you'll learn¶
- Function definition and return values
- Positional and keyword arguments
- Scope basics
Explanation¶
Functions group behavior into reusable units. Prefer small, explicit functions with clear names and predictable return values.
Example¶
Run it in the browser:
Common mistakes¶
- Mutating arguments unexpectedly
- Using mutable default values