**New course!**Every coder should learn

**Generative AI!**

+ 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!

4 Answers

+ 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

+ 1

If there is no remainder, then the modulo operator returns 0 :)
100 % 20 => 0

0

so what if in modulo operator there is no remainder? is it not applicable for modulo operator?

0

ok thanks alot now i understand