aproximate a number
Mikael Olofsson
mikael at isy.liu.se
Mon Aug 29 03:38:38 EDT 2005
Michael Sparks wrote:
> def approx(x):
> return int(x+1.0)
I doubt this is what the OP is looking for.
>>> approx(3.2)
4
>>> approx(3.0)
4
Others have pointed to math.ceil, which is most likely what the OP wants.
/Mikael Olofsson
Universitetslektor (Senior Lecturer [BrE], Associate Professor [AmE])
Linköpings universitet
-----------------------------------------------------------------------
E-Mail: mikael at isy.liu.se
WWW: http://www.dtr.isy.liu.se/en/staff/mikael
Phone: +46 - (0)13 - 28 1343
Telefax: +46 - (0)13 - 28 1339
-----------------------------------------------------------------------
Linköpings kammarkör: www.kammarkoren.com Vi söker tenorer och basar!
More information about the Python-list
mailing list