Account
Categories

Subtract AND Assign Operator


Definition:

The Subtract AND Assign Operator (-=) is used to subtract a value from a variable and store the result in the same variable.

It subtracts the value on the right side from the variable on the left side.

Syntax:

variable -= value

Example:

x = 15
x -= 5  # subtracts 5 from x
print(x)

Output: