+ 2

Floor division and modulo operator?

Can i ask? what is floor division("//") and modulo operator ("%")? I still don't get it in my school there is no lesson with it, so can anyone explain it to me. Thank you in advance!

13th Aug 2018, 10:27 AM
NicoTexT
NicoTexT - avatar
4 ответов
+ 5
Floor division divides and output the quotient rounded down to the nearest integer Example: 5//2 => 2 #because 5/2 is 2.5 rounded down so 2 Modulo operator divides and output the remainder Example: 5%2 => 1 #the remainder is 1
13th Aug 2018, 10:53 AM
Alquen
Alquen - avatar
+ 1
If there is no remainder, then the modulo operator returns 0 :) 100 % 20 => 0
13th Aug 2018, 11:06 AM
Just A Rather Ridiculously Long Username
0
so what if in modulo operator there is no remainder? is it not applicable for modulo operator?
13th Aug 2018, 10:57 AM
NicoTexT
NicoTexT - avatar
0
ok thanks alot now i understand
13th Aug 2018, 11:07 AM
NicoTexT
NicoTexT - avatar