Functions
Learning Path
Hands-on Labs
Each objective has a coding lab that opens in VS Code in your browser
Define and call functions
You will create reusable code blocks with functions. Write a greet function, call functions multiple times with different arguments, and understand the execution flow when functions are called.
Use parameters
You will make functions flexible with parameters. Add single parameters, use multiple parameters, and set default values for optional parameters.
Return values
You will return data from functions. Return single values, return multiple values as tuples, and use return in conditional branches for different outcomes.
Document with docstrings
You will document your functions with docstrings. Write basic docstrings describing function purpose, document parameters with their types and meanings, and document return values.
Understand scope
You will understand variable scope in Python. Recognize local variables inside functions, understand when to use the global keyword, and avoid common scope-related bugs.