To floor a number in Python, you can use the math.floor() function, which returns the largest integer less than or equal to the given number.
- floor()method in Python returns the floor of x i.e., the largest integer not greater than x.
- Also, The method ceil(x) in Pythonreturns a ceiling value of x i.e., the smallest integer greater than or equal to x.
import math
n = 3.7
F_num = math.floor(n)
print(F_num)
Output
3
Leave a Reply