Commit 6fd4cc73 by BellCodeEditor

save project

parent a0161e00
Showing with 7 additions and 7 deletions
...@@ -3,13 +3,13 @@ class Hero: ...@@ -3,13 +3,13 @@ class Hero:
self.name=name self.name=name
self.hp=hp self.hp=hp
self.attack=attack self.attack=attack
def upgrade(self):
self.hp=self.hp+50
self.attack=self.attack+4
houyi=Hero("后羿",250,23) houyi=Hero("后羿",250,23)
yase=Hero("亚瑟",300,20) houyi.upgrade()
def upgrade(): houyi.upgrade()
houyi.hp=houyi.hp+50
houyi.attack=houyi.attack+4
upgrade()
upgrade()
print("后羿的血量为",houyi.hp) print("后羿的血量为",houyi.hp)
print("亚瑟的血量为",yase.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