NEWB: dividing numbers

Chris Rebert clp2 at
Mon Mar 9 00:21:12 CET 2009

On Sun, Mar 8, 2009 at 3:08 PM, Lo <graga at> 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?

Add the following to the top of your program:

from __future__ import division

That tells Python to use the proper kind of division, which is now the
default in Python 3.0.


I have a blog:

More information about the Python-list mailing list