Fix Python – Python 3 integer division [duplicate]


Asked By – Megatron

In Python 3 vs Python 2.6, I’ve noticed that I can divide two integers and get a float. How do you get the Python 2.6 behaviour back?

Is there a different method to get int/int = int?

Now we will see solution for issue: Python 3 integer division [duplicate]


Try this:

a = 1
b = 2
int_div  = a // b

This question is answered By – Lucas Ribeiro

This answer is collected from stackoverflow and reviewed by FixPython community admins, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0