NEWB: dividing numbers

Daniel Dalton d.dalton at iinet.net.au
Mon Mar 9 00:03:41 EDT 2009


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.



More information about the Python-list mailing list