[Tutor] round()

tpc at csua.berkeley.edu tpc at csua.berkeley.edu
Mon Nov 17 11:32:21 EST 2003


hi Wes, you want to use repr().  Here's a earlier post with an answer to a
similar question:

http://mail.python.org/pipermail/python-list/2002-August/118501.html

On Mon, 17 Nov 2003, Wes wrote:

> Hi,
> Why are the results different?
>
> x=2.5463
>
> >>>round(x,2)
> 2.5499999999999998
>
> >>>str(round(x,2))
> '2.55'
>
> Thanks,
> ~wes
> ---------------------
> We need more power captain.
>
>
>
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor
>




More information about the Tutor mailing list