try any one 1) >>>from __future__ import division >>>2/3 -1/3 0.33333333333333331
2) >>>x = 2/3.0 >>>x - 1/3.0 0.33333333333333331 On Mon, Mar 9, 2009 at 9:33 AM, Daniel Dalton <d.dal...@iinet.net.au> wrote: > Hi, > > On Mon, Mar 09, 2009 at 12:08:16AM +0100, Lo wrote: > > I just tried python first time. > > > > 2/3 > > > > the result is zero > > That's because your dividing an int by an int to an int. The definition > of an int is a "whole number". So just use floating point I think it's > called, this should work, and does just tested with the python > interactive shell: > 2.0/3 > > Cheers, > Daniel. > -- > http://mail.python.org/mailman/listinfo/python-list >
-- http://mail.python.org/mailman/listinfo/python-list