# Does Python have floor? [Explain With Example]

Yes, Python has a built-in function called `floor()` that is part of the `math` module. The `floor()` function is used to round a floating-point number down to the nearest integer that is less than or equal to the original number. This is often referred to as “floor division” or “floor rounding”.

Here’s an example of how to use the `floor()` function:

```import math

number = 5.7
result = math.floor(number)

print(result)  # Output: 5
```

In this example, the `math.floor()` function is used to round the floating-point number `5.7` down to the nearest integer, which is `5`.

## What is floor and ceil in Python?

The opposite of the `math.floor()` function in Python is the `math.ceil()` function. The `math.ceil()` function is also part of the `math` module and is used to round a floating-point number up to the nearest integer that is greater than or equal to the original number. This operation is commonly known as “ceiling division” or “ceiling rounding”.

Here’s an example of how to use the `math.ceil()` function:

```import math

number = 5.7
result = math.ceil(number)

print(result)  # Output: 6
```

In this example, the `math.ceil()` function is used to round the floating-point number `5.7` up to the nearest integer, which is `6`.

• 