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, [EMAIL PROTECTED] (Aahz) wrote:
> In article <[EMAIL PROTECTED]>,
> katie smith  <[EMAIL PROTECTED]> 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 ([EMAIL PROTECTED])           <*>        http://www.pythoncraft.com/
>
> "All problems in computer science can be solved by another level of
> indirection."  --Butler Lampson

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

Reply via email to