Lo wrote:
I just tried python first time.
2/3
the result is zero
I want the result to be .333...
How do I get this?
That's integer division (integer divided by integer is integer).
If you want the result to be floating point then make one of them
floating point:
2.0 / 3
or do this first:
from __future__ import division
In the future and in Python 3.x "/" will always return floating point.
For an integer result use "//" instead.
BTW, 2.0/3.0 still isn't 0.333... ;-)
--
http://mail.python.org/mailman/listinfo/python-list