Commit 8b09d6c2 by BellCodeEditor

auto save

parent ae2a34ff
Showing with 15 additions and 0 deletions
class Hore:
def __init__(self,name,hp,attack):
self.level = 1
self.name = name
self.hp = hp
self.attack = attack
def upgrade(self):
self.level = slef.level + 1
self.hp = self.hp + 50
self.attack = self.attack + 20
yase = Hore("亚瑟",100,80)
yase.upgrade()
print("亚瑟升级后等级为:",yase.level)
print("亚瑟升级后血量为:",yase.hp)
print("亚瑟升级后攻击力为:",yase.attack)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment