[Tutor] floats acting like integers???
Hee-Seng Kye
kyeser at earthlink.net
Tue Jul 27 01:51:25 CEST 2004
Hi. To get floats for divisions, either the number you are dividing or
being divided should be a floating point.
>>> a = 1.0 / 7 # or a = 1 / 7.0
>>> a
0.14285714285714285
>>> print a
0.142857142857
Best,
Kye
On Jul 26, 2004, at 7:45 PM, Jeff Peery wrote:
> hello, I have a problem with my IDLE or script. I put in something
> like a=1/7 and I print a and get zero? but this is only for division,
> numbers go to integers? anyone have an idea of why this is happening?
> thanks.
>
>
>
> Jeff
> _______________________________________________
> Tutor maillist - Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor
More information about the Tutor
mailing list