0
Why the output is 3 ? For 20//6 ???
4 Answers
+ 3
in python // is the floor division... it means that the result of the division is always rounded to the lowest number:
in case of negative results, the same principle is applied, rounding result to the most distant number from 0...
+ 3
20/6=3.3333333333333333
so
20//6=3 as you round 3.333333333333333 to the lowest integer...
-15/4=-3.75
so
-15//4=-4 because -3.75 is negative and it's "floor rounded" to lowest integer (again)
0
thankx but it still confusing
0
oh thank u now i understand thankx thankx