This problem is killing me. How does one roundup a number UP in Python?
I tried round(number) but it round the number down. Example:
round(2.3) = 2.0 and not 3, what I would like
The I tried int(number + .5) but it round the number down again! Example:
int(2.3 + .5) = 2
Then I tried round(number + .5) but it won't work in edge cases. Example:
WAIT! THIS WORKED!
Interesting Python 2.x issue to keep in mind:
>>> import math >>> math.ceil(4500/1000) 4.0 >>> math.ceil(4500/1000.0) 5.0
The problem is that dividing two ints in python produces another int and that's truncated before the ceiling call. You have to make one value a float (or cast) to get a correct result.