Python‎ > ‎operator‎ > ‎

operator.imod()

http://www.adilwaseem.com/

Introduction
The return with remainder of division equation same as a %= b.

Syntax
operator.imod(a,b)-> remainder
__imod__

Parameters
a, b=number

Import module
Importing module is required in the Shell window and the Editor window.

Examples
The method return the remainder of equation between a and b.
 >>> operator.imod(2,3)
2
>>> operator.imod(100,2)
0
>>> operator.imod(3,2)
1
>>> operator.imod(5,3)
2

The return with the remainder a divided by b.
 >>> a=pow(2,3)
>>> b=pow(3,2)
>>> operator.imod(a,b)
8
>>> operator.imod(b,a)
1

a%=b
The method return the same value.
>>> a=pow(2,3)
>>> b=pow(3,2)
>>> a%=b
>>> a
8
>>> b%=a
>>> b
1 

operator.__imod__(a,b)
The method equal to imod(a,b).
 >>> a=pow(2,3)
>>> b=pow(3,2)
>>> operator.__imod__(a,b)
8
>>> operator.__imod__(b,a)
1

Comments