Rounding to the nearest 5
Gary Herron
gherron at islandtraining.com
Thu Jan 29 19:22:01 EST 2009
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
round(n,-1) rounds to the nearest 10, so
round(n*2,-1)/2 will round to the nearest five.
Gary Herron
>
>
> Thanks!
>
> ------------------------------------------------------------------------
> Twice the fun— Share photos while you chat with Windows Live
> Messenger. <http://www.microsoft.com/windows/windowslive/messenger.aspx>
> ------------------------------------------------------------------------
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>
More information about the Python-list
mailing list