> ## Documentation Index
> Fetch the complete documentation index at: https://python-training.ipoint-labs.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Module 10: Defining functions

> Split code into functions, return results, and pass arguments by position, by keyword, and with defaults.

| | |
| - | - |
| **Exam** | PCEP-30-03 |
| **Section** | 4. Functions and Exceptions (20% of the exam) |
| **Objectives** | 4.1.1, 4.1.2, and 4.1.3 |
| **Exam questions** | About 3, one per objective |

By the end of this module you can do everything below. The objectives and their wording come from the [official PCEP-30-03 syllabus](https://pythoninstitute.org/pcep-exam-syllabus).

## 4.1.1 Define and invoke user-defined functions

* Explain how functions support code decomposition, reuse, and maintainability.
* Define a function using the `def` keyword.
* Create valid function names according to Python naming rules.
* Define a function body using correct indentation.
* Invoke a user-defined function.
* Trace the order in which function definitions and function calls are executed.

## 4.1.2 Return values from functions

* Use the `return` statement to return a result from a function.
* Assign a returned value to a variable.
* Use returned values in expressions and function calls.
* Explain the difference between returning a value and displaying a value with `print()`.
* Explain how `return` terminates the current function call.
* Return multiple values from a function.
* Recognize when a function implicitly returns `None`.
* Use the `None` value to represent the absence of a meaningful result.

## 4.1.3 Define parameters and pass arguments to functions

* Distinguish between parameters in function definitions and arguments in function calls.
* Pass arguments by position and keyword, and combine them in the correct order.
* Define parameters with default values.
* Call functions using default values or override them with explicit arguments.
* Use keyword arguments with built-in functions such as `print()`, including `sep` and `end`.
* Recognize invalid function calls caused by missing, duplicated, or incorrectly ordered arguments.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.