Commit 529a93a4 by BellCodeEditor

auto save

parent f47689a4
Showing with 24 additions and 0 deletions
class Hero:
def __init__(self,name,hp,attack):
self.level = 1
self.hp = hp
self.attack = attack
def upgrade(self):
self.level += 1
self.hp += 50
self.attack += 25
yase = Hero("亚瑟",350,30)
houyi = Hero("后羿",150,50)
yase.upgrade()
yase.upgrade()
houyi.upgrade()
houyi.upgrade()
print("亚瑟的等级:",yase.level)
print("亚瑟的血量:",yase.hp)
print("亚瑟的攻击力:",yase.attack)
print("后羿的等级:",houyi.level)
print("后羿的血量:",houyi.hp)
print("后羿的攻击力:",houyi.attack)
\ No newline at end of file
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