Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Player():
- def __init__(self, str, vit, agi, hp):
- self.str = str
- self.agi = agi
- self.vit = vit
- self.hp = hp
- def level_up(self, stat):
- if stat == 'agi':
- self.agi += 1
- elif stat == 'vit':
- self.vit += 1
- else:
- self.str += 1
- my_hero = Player(10, 15, 8, 100)
- print(my_hero.str, my_hero.agi, my_hero.vit, my_hero.hp)
- my_hero.level_up("agi")
- print(my_hero.str, my_hero.agi, my_hero.vit, my_hero.hp)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement