Why both answers are not 3 (ignore minus sign)??? | Sololearn: Learn to code for FREE!
Neuer Kurs! Jeder Programmierer sollte generative KI lernen!
Kostenlose Lektion ausprobieren
0

Why both answers are not 3 (ignore minus sign)???

In python, print(11//3) = 3 but, print(-11//3) = -4

6th Nov 2020, 10:04 AM
Mohammad Saidul Arefin Taibin
Mohammad Saidul Arefin Taibin - avatar
3 Antworten
+ 1
Because -11/3 = -3.66666 It will round it to the nearest number(floor) and -4 is lesser than -3 ..
6th Nov 2020, 10:13 AM
Deep Kr. Ghosh
Deep Kr. Ghosh - avatar
0
But, why not 11//3 turned to 4 while it remained 3
6th Nov 2020, 5:30 PM
Mohammad Saidul Arefin Taibin
Mohammad Saidul Arefin Taibin - avatar
0
Because 3 is lesser than 4..
7th Nov 2020, 12:22 AM
Deep Kr. Ghosh
Deep Kr. Ghosh - avatar