Why is int() not rounding to the nearest whole number?
when we write any decimal with int why the comes with small whole number
e.g int (4.9)
out 4
why the output doesn't come nearest whole number
e.g int (4.9)
out 5
1 answers ( 0 marked as helpful)
Hi Alexis,
Thanks for reaching out!
The
Best,
The 365 Team
int()
function returns the integer part of a real number.
If you want the nearest integer number, you can use the round()
function:
![](https://i.udemycdn.com/redactor/raw/2019-09-22_16-38-03-94ac00e3aee20407dfc80621cf0130d4.png)
The 365 Team