ROUNDING???

subeen tamim.shahriar at gmail.com
Mon Feb 18 23:12:47 EST 2008


You can use the round() function. And if you want to print, use %0.2f


regards,
Subeen.
http://love-python.blogspot.com/


On Feb 19, 9:36 am, a... at pythoncraft.com (Aahz) wrote:
> In article <mailman.949.1203389866.9267.python-l... at python.org>,
> katie smith  <iceboy... at yahoo.com> wrote:
>
>
>
> >in python im doing the problem 255/494
>
> >it keeps giving me 0 instead of .51....
> >what am i doing wrong?
> >>> from __future__ import division
> >>> 2/5
>
> 0.40000000000000002
>
> In addition:
>
> >>> division
>
> _Feature((2, 2, 0, 'alpha', 2), (3, 0, 0, 'alpha', 0), 8192)
>
> Therefore this works in Python 2.2 and higher.
> --
> Aahz (a... at pythoncraft.com)           <*>        http://www.pythoncraft.com/
>
> "All problems in computer science can be solved by another level of
> indirection."  --Butler Lampson




More information about the Python-list mailing list