Ceil() Function - Python Math Module

Method Name:

ceil

Method Signature:

ceil(number)

Function Overview: 

  • The function ceil() returns the next integer bigger than the given number.
  • In other words, the method ceil() returns the smallest integer bigger than the given number.

Example:

import math

 

# Find ceiling for pi

ceiling = math.ceil(3.14)

print("Ceiling of pi : {}".format(ceiling))

 

# Find ceiling for square root of pi

ceiling2 = math.ceil(math.sqrt(3.14))

print("Ceiling of square root of pi : {}".format(ceiling2))

Output:

Ceiling of pi : 4

Ceiling of square root of pi : 2


Copyright 2023 © pythontic.com