Python Assignment Operators
Categories: Python
Assume variable a holds 10 and variable b holds 20, then −
Operators - Description - Example = Assigns values from right side operands to left side operandc = a + b assigns value of a + b into c += Add ANDIt adds right operand to the left operand and assign the result to left operandc += a is equivalent to c = c + a -= Subtract ANDIt subtracts right operand from the left operand and assign the result to left operandc -= a is equivalent to c = c - a *= Multiply ANDIt multiplies right operand with the left operand and assign the result to left operandc *= a is equivalent to c = c * a /= Divide ANDIt divides left operand with the right operand and assign the result to left operandc /= a is equivalent to c = c / a %= Modulus ANDIt takes modulus using two operands and assign the result to left operandc %= a is equivalent to c = c % a **= Exponent ANDPerforms exponential (power) calculation on operators and assign value to the left operandc **= a is equivalent to c = c ** a //= Floor DivisionIt performs floor division on operators and assign value to the left operandc //= a is equivalent to c = c // a