Python Assignment Operators
Assignment operators are used to assign values to variables.
Types of Assignment Operators
Operator | Example | Same as |
---|---|---|
= | a=10 | a=10 |
+= | a+=10 | a=a+10 |
-= | a-=10 | a=a-10 |
*= | a*=10 | a=a*10 |
/= | a/=10 | a=a/10 |
%= | a%=10 | a=a%10 |
//= | a//=10 | a=a//10 |
**= | a**=10 | a=a**10 |
&= | a&=10 | a=a&10 |
|= | a|=10 | a=a|10 |
^= | a^=10 | a=a^10 |
//= | a//=10 | a=a//10 |
>>= | a>>=10 | a=a>>10 |
<<= | a<<=10 | a=a<<10 |