Johan Geldenhuys <[EMAIL PROTECTED]> writes:

> Now that I have the answer (16.800000000000001), How do I round it of to 16.80
>      ? I only need it to be to the closest 1/100.

>>> print "%.2f" % 16.800000000000001
16.80
>>> a = 16.8000000000001
>>> b = "%.2f" % a
>>> b
'16.80'
>>> float(b)
16.800000000000001
>>> str(float(b))
'16.8'
>>> 

(The reason for the '000000000001' is because of the numeric base used to
represent data -- binary -- and the numeric base I'm requesting the answer to
be in -- decimal.)


Be seeing you,
-- 
Jorge Godoy      <[EMAIL PROTECTED]>

_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to