Commit 6b204cfa by BellCodeEditor

save project

parent bf55e796
Showing with 6 additions and 6 deletions
...@@ -4,14 +4,14 @@ class Hero: ...@@ -4,14 +4,14 @@ class Hero:
self.name=name self.name=name
self.hp=hp self.hp=hp
self.attack=attack self.attack=attack
def upgrade(self):
self.attack+=4
self.hp+=50
self.level+=1
yase=Hero("亚瑟",300,20) yase=Hero("亚瑟",300,20)
houyi=Hero("后羿",250,23) houyi=Hero("后羿",250,23)
def upgrade(): yase.upgrade()
yase.attack+=4 yase.upgrade()
yase.hp+=50
yase.level+=1
upgrade()
upgrade()
print(yase.name) print(yase.name)
print(yase.attack) print(yase.attack)
print(yase.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