Python - Math floor() Function
The Python Math floor() function is used to return the next lowest integer value by rounding down the specified number, if necessary. In other words, it rounds the fraction DOWN of the given number.
Syntax
floor(x)
Parameters
x |
Required. Specify a number. |
Return Value
Returns the next lowest integer value by rounding DOWN the specified number, if necessary.
Example:
In the below example, floor() function is used to round the fraction DOWN of the specified number.
import math print(math.floor(10.5)) print(math.floor(-10.5)) print(math.floor(0.5)) print(math.floor(-0.5))
The output of the above code will be:
10 -11 0 -1
❮ Python Math Module