Commit 3f0eb14c by BellCodeEditor

save project

parent 43237799
Showing with 7 additions and 8 deletions
......@@ -5,16 +5,15 @@ class Hero:
self.hp=hp
self.attack=attack
def upgrade(self):
self.level+=1
self.hp+=50
self.attack+=10
wo=Hero("我",1000,500)
ni=Hero("你",100,12)
def upgrade():
wo.level+=1
wo.hp+=50
wo.attack+=10
upgrade()
upgrade()
wo.upgrade()
ni.upgrade()
print("我的等级为:",wo.level)
print("我的血量为:",wo.hp)
print("我的攻击力为:",wo.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