ExampleEdit & Run
#import the math module
import math

#use the floor() function
print(math.floor(0.5))
print(math.floor(9.9))
copy
Output:
0 9 [Finished in 0.010646068025380373s]

The math.floor() function returns the floor value of a real number, which is the largest integer less than or equal to the number. For example, the floor value of 4.7 is 4, because 4 is the largest integer less than or equal to 4.7. Similarly, the floor value of -3.2 is -4, because -4 is the largest integer less than or equal to -3.2.

Syntax:
math.floor(x)
copy
x The number whose floor value is to be determined.  It can be any valid real number i.e a floating point value or an integer.
Parameters:

The function returns the floor value of x. If x is an integer the return value is just as same as x.

ExampleEdit & Run
import math

print( math.floor(3) )

print( math.floor(-4.0) )

print( math.floor(-5.5) )

print( math.floor(5.5) )

print( math.floor(9.9) )

print( math.floor(-18.6) )

print( math.floor(100.9) )
copy
Output:
3 -4 -6 5 9 -19 100 [Finished in 0.010471247136592865s]

Compare math.floor() with math.ceil() which returns the smallest integer greater then or equal to the input.