Doesn't this work?

round_by_5.py

>>>>>>>>>>>>>>>>>>>>>>>

import sys

def round_by_5(x= sys.argv[0]):
    x = x/5.
    x = round(x)
    x = x*5
    print(x)
    return x 

Ben R.


-----Original Message-----
From: python-list-bounces+bjracine=glosten....@python.org 
[mailto:python-list-bounces+bjracine=glosten....@python.org] On Behalf Of 
D'Arcy J.M. Cain
Sent: Friday, January 30, 2009 6:07 AM
To: Steven D'Aprano
Cc: python-list@python.org
Subject: Re: Rounding to the nearest 5

On 30 Jan 2009 06:23:17 GMT
Steven D'Aprano <ste...@remove.this.cybersource.com.au> wrote:
> On Fri, 30 Jan 2009 00:24:47 -0500, D'Arcy J.M. Cain wrote:
> > That appears to be rounding to nearest 10, not 5.  Clarify your 
> > requirements first.
> 
> Look again. 36 => 35.

You are correct.  I should have ommitted my first sentence and emphasized the 
second.  :-)

-- 
D'Arcy J.M. Cain <da...@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.
--
http://mail.python.org/mailman/listinfo/python-list
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to