Round numbers down to the nearest integer:
# Import math library
import math
# Round numbers down to the nearest integer
print(math.floor(0.6))
print(math.floor(1.4))
print(math.floor(5.3))
print(math.floor(-5.3))
print(math.floor(22.6))
print(math.floor(10.0))
Try it Yourself » Definition and UsageThe math.floor()
method rounds a number DOWN to the nearest integer, if necessary, and returns the result.
Tip: To round a number UP to the nearest integer, look at the math.ceil()
method.
int
value, representing the rounded number Change Log: Python 3+ : Returns an int
value
float
value
Track your progress - it's free!
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4