# Python Math

Python has a set of built-in math functions, including an extensive math module, that allows you to perform mathematical tasks on numbers.

***

### Built-in Math Functions

The `min()` and `max()` functions can be used to find the lowest or highest value in an iterable:

```
x = min(5, 10, 25)
y = max(5, 10, 25)

print(x)
print(y)
```

The `abs()` function returns the absolute (positive) value of the specified number:

#### Example

```
x = abs(-7.25)

print(x)
```

The `pow(`*`x`*`,`` `*`y`*`)` function returns the value of x to the power of y (xy).

#### Example

Return the value of 4 to the power of 3 (same as 4 \* 4 \* 4):

```
x = pow(4, 3)

print(x)
```

### The Math Module

Python has also a built-in module called `math`, which extends the list of mathematical functions.

To use it, you must import the `math` module:

import math

When you have imported the `math` module, you can start using methods and constants of the module.

The `math.sqrt()` method for example, returns the square root of a number:

#### Example

```
import math

x = math.sqrt(64)

print(x)
```

The `math.ceil()` method rounds a number upwards to its nearest integer, and the `math.floor()` method rounds a number downwards to its nearest integer, and returns the result:

#### Example

```
import math

x = math.ceil(1.4)
y = math.floor(1.4)

print(x) # returns 2
print(y) # returns 1
```

The `math.pi` constant, returns the value of PI (3.14...):

#### Example

```
import math

x = math.pi

print(x)
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.pyclubs.org/python-course-guide/guides/operators/python-math.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
