How to fix a : TypeError 'tuple' object does not support item assignment
Change this
badguy[0]-=7
into this
badguy = list(badguy)
badguy[0]-=7
badguy = tuple(badguy)
Alternatively, if you can leave badguy
as a list
, then don't even use tuples and you'll be fine with your current code (with the added change of using lists instead of tuples)
Another solution is instead of
badguy[0] -= 7
to do
badguy = (badguy[0] - 7,) + badguy[1:]
This creates a new tuple altogether with the updated value in the zeroth element.