Commit 5beb347e by BellCodeEditor

save project

parent 2b137165
Showing with 11 additions and 2 deletions
...@@ -5,5 +5,15 @@ class Hero: ...@@ -5,5 +5,15 @@ class Hero:
self.attack=attack self.attack=attack
houyi=Hero("后羿",500,50) houyi=Hero("后羿",500,50)
yase=Hero("亚瑟",400,30) yase=Hero("亚瑟",400,30)
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) print("亚瑟的血量",yase.hp)
\ 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