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
```

Code language: Python (python)

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
```

Code language: Python (python)

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`

.

**Read More;**

- Python calling yaml.load() without loader=… is deprecated
- What is the use of #! (shebang) In Python?
- How to Use Poetry in Python?
- What is tkinter used for in Python?
- How do I fix KeyError in Python?
- What is kwargs in Python With Example?
- How does Kivy work with Python?
- What Is qt For Python With Examples
- What is a non-blocking code in Python?
- What is the Keras Model in Python With Example?
- What is the difference between Python and py command?
- What is the difference between py and PYW file?