2.3.3 Assignment Operators
Python Programming
Assignment operators are used to assign values to variables. The most common assignment operator is the equal sign (=), which assigns the value on the right to the variable on the left. There are also compound assignment operators like +=, -=, *=, and /=, which combine arithmetic operations with assignment.
python
# Define initial values
a = 10
b = 5
# Assignment
assignment = a; print("a =", assignment) # Output: a = 10
# Addition assignment
a += b; print("a after addition =", a)# Output: a = 15
# Subtraction assignment
a -= b; print("a after subtraction ="