Assignment Operators

This lesson showcases Python's various assignment operators and their purpose.

We'll cover the following

This is a category of operators which is used to assign values to a variable. The = operator is an assignment operator, but not the only one.

Here’s a list of all the assignment operators supported in Python:

Operator Purpose Notation
= Assign In-fix
+= Add and Assign In-fix
-= Subtract and Assign In-fix
*= Multiply and Assign In-fix
/= Divide and Assign In-fix
//= Divide, Floor, and Assign In-fix
**= Raise power and Assign In-fix
%= Take Modulo and Assign In-fix
|= OR and Assign In-fix
&= AND and Assign In-fix
^= XOR and Assign In-fix
>>= Right-shift and Assign In-fix
<<= Left-shift and Assign In-fix

Assigning Values

Let’s go through a few examples to see how values are assigned to variables.

Variables are mutable, so we can change their values whenever we want!

Get hands-on with 1200+ tech skills courses.