round down to nearest number

Hrvoje Niksic hniksic at xemacs.org
Sat Feb 11 05:26:08 EST 2012


Terry Reedy <tjreedy at udel.edu> writes:

> On 2/9/2012 8:23 PM, noydb wrote:
>> So how would you round UP always?  Say the number is 3219, so you want
>>>> (3333//100+1)*100
> 3400

Note that that doesn't work for numbers that are already round:

>>> (3300//100+1)*100
3400    # 3300 would be correct

I'd go with Chris Rebert's (x + 99) // 100.



More information about the Python-list mailing list