hey, explain 7%(5//2) how i got 1? | Sololearn: Learn to code for FREE!
Nouvelle formation ! Tous les codeurs devraient apprendre l'IA générative !
Essayez une leçon gratuite
0

hey, explain 7%(5//2) how i got 1?

25th Nov 2019, 4:36 PM
Eggor Dmitruk🦀
2 Réponses
+ 9
Егор Дмитрук 5//2 is integer division which returns 2 and remainder is 1 5//2 = 2 Now 7%2 = 1 Remainder is 1 so final answer is 1
25th Nov 2019, 4:43 PM
GAWEN STEASY
GAWEN STEASY - avatar
+ 1
5/2 does division of 5 by 2 so, it equals 2.5 but 5//2 does integer division so, instead 2.5, it'll give 2 % does modulus division. 7%2 will divide 7 by 2 and give the remainder. It's 1
25th Nov 2019, 4:50 PM
Sarthak
Sarthak - avatar