class Player:
def __init__(self, name):
self.name = name
self.level = 1
self.exp = 0
def gain_exp(self, amount):
self.exp += amount
if self.exp >= 100:
self.level += 1
self.exp = 0
player = Player("Hero")
player.gain_exp(120)
print("레벨:", player.level)
print("경험치:", player.exp)
To embed this project on your website, copy the following code and paste it into your website's HTML: