The **ceil()** is a built-in **Python** **function** that rounds a number up to the nearest integer. There is one more function called floor(), which we will see, and then we will know the difference between **int()** and **floor()** function.

**Python int()**

The **int()** is a built-in **Python** that converts a specified value into an integer value. The **int()** function returns an integer object constructed from a number or string or returns 0 if no arguments are given.

**Python floor()**

The floor() is a built-in Python function that returns a float value of numeric input value. The **floor()** method takes an argument: the number you want to return. In Python 3, the **math.floor()** returns an **integer value**.

**Python int() vs floor()**

The main difference between the **int()** and **floor()** function is that **int()** function truncates** **the number and **floor()** function **rounds** **down**. The difference between **int()** and **floor()** functions will be clear when using negative numbers.

```
import math
dt = math.floor(-4.5)
print(dt)
data = int(-4.5)
print(data)
```

**Output**

```
-5
-4
```

You can see the difference between the outputs. The rounding down on negative numbers means that they move away from **0**, truncating moves them closer to **0**. In short, the **floor()** will always be lower or equal to the original. The **int() **function will be closer to **zero** or **equal**.

That’s it for int() vs floor() in Python article.

**More posts**

Krunal Lathiya is a Software Engineer with over eight years of experience. He has developed a strong foundation in computer science principles and a passion for problem-solving. In addition, Krunal has excellent knowledge of Data Science and Machine Learning, and he is an expert in R Language. Krunal has experience with various programming languages and technologies, including PHP, Python, and JavaScript. He is comfortable working in front-end and back-end development.