Commit 08570667 by BellCodeEditor

save project

parent 0887446a
Showing with 8 additions and 6 deletions
......@@ -4,14 +4,16 @@ class hero:
self.name=name
self.hp=hp
self.attack=attack
def upgrade(self):
self.level+=1
self.hp+=20
self.attack+=10
zhouyu=hero('周瑜',240,30)
zhangfei=hero('张飞',300,40)
def upgrade():
zhouyu.level+=1
zhouyu.hp+=20
zhouyu.attack+=10
upgrade()
zhouyu.upgrade()
zhangfei.upgrade()
print(zhouyu.name)
print(zhouyu.hp)
print(zhouyu.attack)
......
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