YouTip LogoYouTip

Python3 Func Number Floor

# Python3.x Python3 floor() Function [![Image 3: Python3 Numbers](#) Python3 Numbers](#) * * * ## Description The floor() function returns the floor of x, the largest integer less than or equal to x. * * * ## Syntax Here is the syntax for the floor() method: import math math.floor( x ) **Note:** floor() cannot be accessed directly, you need to import the math module and call the method via a static object. * * * ## Parameters * x -- This is a numeric expression. * * * ## Return Value Returns the largest integer less than or equal to x. * * * ## Example The following example shows the usage of the floor() method: #!/usr/bin/pythonimport math # Import math moduleprint ("math.floor(-45.17) : ", math.floor(-45.17))print ("math.floor(100.12) : ", math.floor(100.12))print ("math.floor(100.72) : ", math.floor(100.72))print ("math.floor(math.pi) : ", math.floor(math.pi)) When the above program is run, it produces the following result: math.floor(-45.17) : -46 math.floor(100.12) : 100 math.floor(100.72) : 100 math.floor(math.pi) : 3 [![Image 4: Python3 Numbers](#) Python3 Numbers](#)
← Python3 Func Number Log10Python3 Func Number Floor β†’