I am relatively new to python and am working on a text based rpg game written in python to improve at it. While trying to set my player's attack damage equal to its strength + weaponattack, I keep running into a problem. The two variables don't add.
class player:
strength = 10
weaponattack=0
attack = strength + weaponattack
#other code outside of class
player.weaponattack = 10
print(player.attack)
I expect print(player.attack) to output 20, yet it outputs 10. Could someone please tell me how to fix this?