What is modulo % operator in Python?

PythonServer Side ProgrammingProgramming

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
raja
Published on 13-Feb-2018 10:14:05
Advertisements