0

Why the output is 3 ? For 20//6 ???

29th Aug 2017, 6:06 AM
sazzad
4 odpowiedzi
+ 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...
29th Aug 2017, 6:13 AM
Luca
Luca - avatar
+ 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)
29th Aug 2017, 6:18 AM
Luca
Luca - avatar
0
thankx but it still confusing
29th Aug 2017, 6:15 AM
sazzad
0
oh thank u now i understand thankx thankx
29th Aug 2017, 7:38 AM
sazzad