Commit 939d3c61 by BellCodeEditor

save project

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