Home » Backend » Python » %= (modulus assignment)
This %= (modulus assignment) assignment operator computes the variable and a value and assigns the result to that variable.
%=
A %= B
Here,
Note: This is equivalent to A = A % B
>>> a = 5 >>> a %= 2 >>> a 1