Saturday, March 3, 2018

Number ceil() Method


Number ceil() Method in Python 3:


Description
     The ceil() method returns the ceiling value of x, i.e. the smallest integer not less than x.

Syntax
Following is the syntax for the ceil() method
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 the math static object.

Parameters
x - This is a numeric expression.

Return Value
This method returns the smallest integer not less than x.

Example
The following example shows the usage of the ceil() method.





When we run the above program, it produces the following result –