Modulo

Python has many operators that allow you to perform calculations with values. You’ve probably seen and used the basic ones like +(add), - (subtract), * (multiply), and / (divide).

However, Python has some other less common opertors that can be really helpful.

One such operator is the modulo operator (%). This operator takes two values, divides them, and returns the remainder of the division. Try out the following operations using modulo to get an idea for how it works:

Calculation Result
5%3
3%3
6%2
0%6
5%0