billiejoex wrote:

> Hi all. I'd need to aproximate a given float number into the next (int)
> bigger one. Because of my bad english I try to explain it with some
> example:
> 
> 5.7 --> 6
> 52.987 --> 53
> 3.34 --> 4
> 2.1 --> 3

What about 2.0? By your spec that should be rounded to 3 - is that what you
intend?

If you do, you can simply do this:

def approx(x):
    return int(x+1.0)

Regards,


Michael.
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to