How do you round UP a number?
In Python, you can use the ceil()
function from the math
module to round a number up. Here is an example:
This will output 4
, because 3.14
rounds up to 4
.
Another way is to use the round()
function. round()
function round a number to the nearest integer, if the decimal part of the number is >= 0.5, then it rounds up, otherwise it rounds down.
This will also output 4
, because 3.14
is rounded up to 4
.