0
Why (-5//2) = -3?
Please explain this. #python
3 Respuestas
+ 2
It divides: -5/2=-2.5, and then makes it the integer below (-3).
a//b == math.floor(a/b)
+ 3
Anash🇧🇩
The result of // operator is similar to floor division result.
Follow number line concept
..... -3 -2 -1 0 1 2 3 ...
5/2= 2.5 next lower value is 2
So 5//2 =2
-5/2= -2.5 next lower value is -3
So -5//2= -3
Check math.floor() method
+ 1
Ajith Nikolai Ivanov Thank you so much... Nice explain.