On Sat, Feb 15, 2014 at 9:04 PM, Frank Millman <fr...@chagford.com> wrote:
> If you are using python2, an integer divided by an integer always returns an
> integer -
>
>>>> 10/3
> 3
>
> It was changed in python3 to return a float -
>
>>>> 10/3
> 3.3333333333333335
>
> You can reproduce the python3 behaviour in python2 by adding a 'future'
> directive -
>
>>>> from __future__ import division
>>>> 10/3
> 3.3333333333333335
>

Conversely, you can get an integer result by using floor division:

>>> 10//3
3

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to