Python floor() Function: Complete Guide
The floor function in Python is used to return the largest integer value that is not greater than the input parameter, also known as rounding down.
To use the floor function, first import the math module, then call the math.floor() function, passing the number to be rounded down as a parameter to the function.
For example:
import math
x = 3.5
result = math.floor(x)
print(result) # 输出为3
In the example above, we imported the math module and passed 3.5 as a parameter to the math.floor() function, which returns the largest integer value that is not greater than 3.5, which is 3.