> ## 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 11: Flexible arguments and scope

> Accept any number of arguments with *args and **kwargs, and control where names live with local and global scope.

| | |
| - | - |
| **Exam** | PCEP-30-03 |
| **Section** | 4. Functions and Exceptions (20% of the exam) |
| **Objectives** | 4.1.4 and 4.1.5 |
| **Exam questions** | About 2, 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.4 Accept variable numbers of arguments

* Use `*args` to collect additional positional arguments.
* Explain that `*args` stores collected arguments in a tuple.
* Iterate through values received through `*args`.
* Use `**kwargs` to collect additional keyword arguments.
* Explain that `**kwargs` stores collected arguments in a dictionary.
* Access and process keys and values received through `**kwargs`.
* Combine standard parameters, default parameters, `*args`, and `**kwargs` in a valid function definition.

## 4.1.5 Manage variable scope

* Distinguish between local and global name scopes.
* Explain how names created inside a function are resolved.
* Recognize namespaces and variable shadowing.
* Use the `global` keyword to modify a global variable from inside a function.
* Explain the risks associated with excessive use of global variables.


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