The floor()
function returns the next largest integer less than or equal to a number. Figure 1 below shows the mathematical representation of the floor()
function.
The
math
module is required for this function.
floor(number)
This function requires a number to round down as a parameter.
The floor()
function returns the next largest integer less than or equal to the number set as a parameter.
import math#positive integer sent as parameterprint "floor(10) : ", math.floor(10)#negative integer sent as parameterprint "floor(-10) : ", math.floor(-10)#positive float value sent as parameterprint "floor(2.1) : ", math.floor(2.1)#negative float value sent as parameterprint "floor(-2.1) : ", math.floor(-2.1)