Python 3 int division operator is returning a float?
09:46 14 Mar 2018

In Python 3, division by / returns a floating point number, and // means integer division and should return an integer. I've discovered though that if either of the values is a float when doing integer division, it will return a float:

# expected
10 / 2
-> 5.0
11 / 2
-> 5.5
10 // 2
-> 5
11 // 2
-> 5
# Here things start to get weird
10.0 // 2
-> 5.0
10 // 2.0
-> 5.0
11.0 // 2
-> 5.0

Is this supposed to behave this way? If so, why does it behave this way?

python python-3.x floating-point integer division