+ 2

Why 11//3 is 3 but -11//3 is -4 in python?

12th Jun 2017, 12:15 PM
Md. Tarek Rahman
Md. Tarek Rahman - avatar
2 Answers
+ 11
Because // returns the rounded down number. 11/3 = 3,666666... the smaller int number is 3 => 11//3 = 3 -11/3 = -3,66666... the smaller int number is -4 => -11//3 = -4
12th Jun 2017, 12:21 PM
Tato
Tato - avatar
+ 1
Thanks, Arctica. Got it now.
12th Jun 2017, 1:53 PM
Md. Tarek Rahman
Md. Tarek Rahman - avatar