Commit b02375bb by BellCodeEditor

save project

parent 39d291f9
Showing with 8 additions and 11 deletions
......@@ -4,16 +4,14 @@ class Hero:
self.name=name
self.hp=hp
self.attack=attack
def upgrade():
yase.level+=1
yase.hp+=50
yase.attack+=4
def upgrade(self):
houyi.level+=1
houyi.hp+=50
houyi.attack+=4
yase=Hero('yase',300,20)
houyi=Hero('houyi',240,23)
k=Hero('K',5600,199)
print("亚瑟的初始血量为",yase.hp)
upgrade()
upgrade()
print("升级2次后,亚瑟的血量为",yase.hp)
print(k.attack)
\ No newline at end of file
houyi.upgrade()
print("攻击力为",houyi.hp)
print("等级为",houyi.hp)
print("血量为",houyi.hp)
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