Commit 7e5b7566 by BellCodeEditor

save project

parent 85c7a08b
Showing with 17 additions and 16 deletions
...@@ -4,19 +4,21 @@ class Hero(): ...@@ -4,19 +4,21 @@ class Hero():
self.name=name self.name=name
self.hp=hp self.hp=hp
self.attack=attack self.attack=attack
houyi=Hero("后羿",300,40)
houyi.hp350
print(houyi.hp)
def upgrate(): def upgrate(self):
houyi.level=houyi.level+1 self.level=self.level+1
houyi.ouyi.hp=houyi.hp+50 self.hp=self.hp+50
houyi.attack=houyi.attack+5 self.attack=self.attack+5
upgrate() yase=Hero("亚瑟",300,40)
upgrate() yase.upgrate()
upgrate() print("*"*300)
upgrate() print(yase.hp)
upgrate() print(yase.name)
upgrate() print(yase.attack)
upgrate() print("*"*300)
upgrate() houyi=Hero("后羿",200,50)
\ No newline at end of file houyi.upgrate()
print(houyi.hp)
print(houyi.name)
print(houyi.attack)
print("*"*300)
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