Rounding to the nearest 5

D'Arcy J.M. Cain darcy at druid.net
Fri Jan 30 00:24:47 EST 2009


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.

-- 
D'Arcy J.M. Cain <darcy at druid.net>         |  Democracy is three wolves
http://www.druid.net/darcy/                |  and a sheep voting on
+1 416 425 1212     (DoD#0082)    (eNTP)   |  what's for dinner.



More information about the Python-list mailing list