+ 1
explaination for this python floor division ?
why this code >>>print(11//3) yields 3 ,while that code >>>print(-11//3) yields -4 ?
2 Answers
+ 6
// basically seems to floor the result.
11/3 == 3.666, so 3 (lowered)
-11/3== -3.666, so -4 (also lowered)
+ 6
Because // is not getting rid of the fractional part, it is flooring, it rounds to the closest minimum.