math.ceil()
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 1
Use math.ceil()
to return the ceiling of 134.2
:
import mathprint(math.ceil(134.2))# Output: 135
Example 2
Use math.ceil()
to return the ceiling of 412.959
:
import mathprint(math.ceil(412.959))# Output: 413
Contributors
- Anonymous contributors