Python Basics
Python Advanced
Python Useful References
Python Useful Resources
Selected Reading
© 2011 TutorialsPoint.COM
|
Python Number ceil() Function
Description:
This function returns ceiling value of x - the smallest integer not less than x.
Syntax:
import math
math.ceil( x )
|
Note: This function is not accessible directly so we need to import math module and then we need to call this function using math static object.
Parameters:
Here is the detail of parameters:
Return Value:
The smallest integer not less than x.
Example:
#!/usr/bin/python
import math # This will import math module
print "math.ceil(-45.17) : ", math.ceil(-45.17)
print "math.ceil(100.12) : ", math.ceil(100.12)
print "math.ceil(100.72) : ", math.ceil(100.72)
print "math.ceil(119L) : ", math.ceil(119L)
print "math.ceil(math.pi) : ", math.ceil(math.pi)
|
This will produce following result:
math.ceil(-45.17) : -45.0
math.ceil(100.12) : 101.0
math.ceil(100.72) : 101.0
math.ceil(119L) : 119.0
math.ceil(math.pi) : 4.0
|
|
|
|