Augmented Assignment
An augmented assignment changes a variable based on the value it already has.
minutes = 2
minutes *= 60
minutes += 30
minutes -= 15
print(minutes)
Output:
135
minutes *= 60 is a short way to write minutes = minutes * 60. It turns 2 into 120. Next, += 30 adds 30, and -= 15 subtracts 15. You can use this short form with the other arithmetic operators too.
Python has no ++ operator. To add 1 to a count, write count += 1.
Add a bonus and subtract a penalty from a game score in the exercise.