[Tutor] decimal precision
Michael Connors
connorsml at gmail.com
Tue Mar 25 14:30:55 CET 2008
On 25/03/2008, elis aeris <hunter92383 at gmail.com> wrote:
>
> x = 53
> w = 192
> for a in range ( x, (x+192) ):
> print (a-x)/w
>
>
> the problem is at (a-x)/w
>
> it's supposed to return a ratio between x and w, yet it 0 all the time.
>
> _______________________________________________
> Tutor maillist - Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor
>
>
I think to do float division the operands should be floats.
So if you do:
print float(a-x) / float(w)
It should produce a floating point result.
--
Michael Connors
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tutor/attachments/20080325/049bfc22/attachment.htm
More information about the Tutor
mailing list