math.ceil()
Published May 19, 2021Updated Mar 17, 2024
Contribute to Docs
Takes in a numeric data type and rounds the value up to the nearest integer.
Syntax
math.ceil(n)
The math.ceil()
function takes in a value and returns its ceiling, the smallest integer greater than or equal to that value.
Example
Use math.ceil()
to return the ceiling of 134.2
:
import mathprint(math.ceil(134.2))
The above code gives the following output:
135
Codebyte Example
Run the following example that uses the math.ceil()
function to understand its working:
All contributors
- karthikMurali1651016565
- cslylla
- christian.dinh
- Anonymous contributor
- Anonymous contributor
- ishg-153
Contribute to Docs
- Learn more about how to get involved.
- Edit this page on GitHub to fix an error or make an improvement.
- Submit feedback to let us know how we can improve Docs.
Learn Python on Codecademy
- Career path
Computer Science
Looking for an introduction to the theory behind programming? Master Python while learning data structures, algorithms, and more!Includes 6 CoursesWith Professional CertificationBeginner Friendly75 hours - Course
Learn Python 3
Learn the basics of Python 3.12, one of the most powerful, versatile, and in-demand programming languages today.With CertificateBeginner Friendly23 hours