> ## 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 14: Modules and imports

> Import existing code, do math with the math module, and generate repeatable pseudorandom values with random.

| | |
| - | - |
| **Exam** | PCEP-30-03 |
| **Section** | 5. File Handling and Module Imports (14% of the exam) |
| **Objectives** | 5.2.1, 5.2.2, and 5.2.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).

## 5.2.1 Import and use modules

* Explain the purpose and benefits of importing existing code.
* Use the `import` keyword to load a module.
* Access objects provided by an imported module.

## 5.2.2 Perform mathematical evaluations using the `math` module

* Import and use the `math` module.
* Round values upward using `ceil()`.
* Round values downward using `floor()`.
* Remove the fractional part of a value using `trunc()`.
* Calculate square roots using `sqrt()`.

## 5.2.3 Generate and select pseudorandom values using the `random` module

* Import and use the `random` module.
* Generate pseudorandom floating-point values using `random()`.
* Initialize the pseudorandom number generator using `seed()`.
* Explain how setting a seed can produce repeatable results.
* Select a random element from a sequence using `choice()`.
* Select multiple unique elements using `sample()`.


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