Skip to content

Assignment Operators

Assignment operators are used to assign values to variables.

Below program implements all the different types of Assignment Operations one can use in Python.

a = 5
# Addition AND
a += 3
print(a)

# Subtraction AND
a -= 3
print(a)

# Multiplication AND
a *= 3
print(a)

# Division AND
a /= 3
print(a)

# Modulus AND
a %= 3
print(a)

# Exponent AND
a **= 3
print(a)

Output

8
5
15
5.0
2.0
8.0