如何将模算术方程转换为python代码?

问题描述

(x/y) mod n = ((x mod n) * (y mod n)^-1) mod n

我想知道如何将上面的语句转换成python。

解决方法

你可以这样做,

考虑,

x=10
y=5
n=2
# You can use if condition to evaluate the expression
if (x/y)%n==((x%n)*(y%n)**(-1)):
    print('Condition satisfied')
else:
    print('Condition not satisfied')