Python 3 integer division

Question:

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?

Asked By: Megatron

||

Answers:

Try this:

a = 1
b = 2
int_div  = a // b
Answered By: Lucas Ribeiro
Categories: questions Tags: , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.