Func Number Floor
# Python2.x Python floor() Function
[ Python Numbers](#)
* * *
## Description
The floor() function returns the floor integer of a number.
* * *
## Syntax
Here is the syntax for the floor() method:
import math math.floor( x )
**Note:** The floor() function cannot be accessed directly. You need to import the math module and call the method via a static object.
* * *
## Parameters
* x -- A numeric expression.
* * *
## Return Value
Returns the floor integer of a number.
* * *
## Example
The following example demonstrates the use of the floor() method:
#!/usr/bin/pythonimport math # This will 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(119L) : ", math.floor(119L)print "math.floor(math.pi) : ", math.floor(math.pi)
The output of the above example is:
math.floor(-45.17) : -46.0 math.floor(100.12) : 100.0 math.floor(100.72) : 100.0 math.floor(119L) : 119.0 math.floor(math.pi) : 3.0
[ Python Numbers](#)
YouTip