Commit 939d3c61 by BellCodeEditor

save project

parent 4a375e6b
Showing with 8 additions and 7 deletions
...@@ -4,12 +4,13 @@ class hero: ...@@ -4,12 +4,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.level=self.level+1
self.hp=self.hp+55
self.attack=self.attack+10
lq=hero("狂铁",300,25) lq=hero("狂铁",300,25)
print(lq.hp) ccc=hero("李信",190,20)
def upgrade(): ccc.upgrade()
lq.level=lq.level+1 print(ccc.hp)
lq.hp=lq.hp+55 lq.upgrade()
lq.attack=lq.attack+10
upgrade()
upgrade()
print(lq.hp) print(lq.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