Integer division returning “incorrect” values
- division
- integer
Python 2
In Python 2.x integer division will result in an integer output, confusing users.
>>> 1/2
0
>>> 1.0/2.0
0.5
Python 3
In Python 3.x this issue is “fixed” by division of integers returning a float.
>>>1/2
0.5
N.B. : for both Python 2.x and 3.x //
can be used to ensure true integer division.