On Wed, Apr 8, 2009 at 9:03 AM, Avi <avinashr...@gmail.com> wrote:
> Hi,
>
> This will be a very simple question to ask all the awesome programmers
> here:
>
> How can I get answer in in decimals for such a math operator:
>
> 3/2
>
> I get 1. I want to get 1.5

Add the following line to the top of your program (or use Python 3.0+):
from __future__ import division

To get integer division when this is enabled, use the integer division
operator, //
e.g. x = 3//2 #x=1

Cheers,
Chris

-- 
I have a blog:
http://blog.rebertia.com
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to