What is the result of this code? >>> 7%(5 // 2) | Sololearn: Learn to code for FREE!
Новый курс! Каждый программист должен знать генеративный ИИ!
Попробуйте бесплатный урок
0

What is the result of this code? >>> 7%(5 // 2)

i dont get it

30th Jul 2017, 4:07 PM
haroon
haroon - avatar
2 ответов
+ 1
5 // 2 is integer/floor division, basically how many 2s go into 5. It goes in twice, so 5 // 2 = 2. Notice the answer must be an integer. 7 % 2 is simply the remainder when 7 is divided by 2. 2 goes in 3 times with remainder 1, so the answer is 1.
30th Jul 2017, 5:06 PM
Dan Walker
Dan Walker - avatar
0
1. 7%(2)=1
30th Jul 2017, 4:10 PM
‎ ‏‏‎Anonymous Guy