Computer >> Computer tutorials >  >> Programming >> Python

What is modulo % operator in Python?


The % symbol is defined in Python as modulo operator. It can also be called remainder operator. It returns remainder of division of two numeric operands (except complex numbers).

>>> a=10
>>> b=3
>>> a%b
1
>>> a=12.25
>>> b=4
>>> a%b
0.25
>>> a=-10
>>> b=6
>>> a%b
2
>>> a=1.55
>>> b=0.05
>>> a%b
0.04999999999999996