Rounding to the nearest 5
Steven D'Aprano
steven at REMOVE.THIS.cybersource.com.au
Fri Jan 30 01:23:17 EST 2009
On Fri, 30 Jan 2009 00:24:47 -0500, D'Arcy J.M. Cain wrote:
> On Thu, 29 Jan 2009 16:06:09 -0800
> "todpose at hotmail.com" <todpose at hotmail.com> wrote:
>> How can you make python round numbers to the nearest 5:
>>
>> Example:
>>
>> 3 => 0
>> 8 => 10
>> 23.2 => 20
>> 36 => 35
>> 51.5 => 50
>
> That appears to be rounding to nearest 10, not 5. Clarify your
> requirements first.
Look again. 36 => 35.
--
Steven
More information about the Python-list
mailing list