Commit 7cbc4e6e by BellCodeEditor

save project

parent 5beb347e
Showing with 7 additions and 12 deletions
...@@ -3,17 +3,12 @@ class Hero: ...@@ -3,17 +3,12 @@ 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("后羿",500,50) houyi=Hero("后羿",500,50)
yase=Hero("亚瑟",400,30) houyi.upgrade()
def upgrade():
yase.hp=yase.hp+50
yase.attack=yase.attack+4
upgrade()
upgrade()
def 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