Facebook Page Twitter Page LinkedIn Page
× Python Tutorial Python Advanced Python Resources Python Libraries


The Python Math ceil() function is used to return the next highest integer value by rounding up the specified number, if necessary. In other words, it rounds the fraction UP of the given number.

Syntax

ceil(x)  

Parameters

x Required. Specify a number.

Return Value

Returns the next highest integer value by rounding UP the specified number, if necessary.

Example:

In the below example, ceil() function is used to round the fraction UP of the specified number.

import math

print(math.ceil(10.5))
print(math.ceil(-10.5))
print(math.ceil(0.5))
print(math.ceil(-0.5))

The output of the above code will be:

11
-10
1
0

❮ Python Math Module