Python | sympy.Mod() method
Last Updated :
02 Aug, 2019
With the help of sympy.Mod()
method, we can find the modulus and can give the parameters separately by using sympy.Mod()
method.
Syntax : sympy.Mod(var1, var2)
Return : Return a value of modulo.
Example #1 :
In this example we can see that by using sympy.Mod()
method, we are able to find the modulus for a given parameters.
from sympy import *
x, y = symbols( 'x y' )
gfg = Mod(x, y).subs({x: 7 , y: 2 })
print (gfg)
|
Output :
1
Example #2 :
from sympy import *
x, y = symbols( 'x y' )
gfg = Mod(x * * 2 , y).subs({x: 7 , y: 5 })
print (gfg)
|
Output :
4
Like Article
Suggest improvement
Share your thoughts in the comments
Please Login to comment...