Commit 51a1cea7 by BellCodeEditor

save project

parent b3c5e57e
Showing with 13 additions and 7 deletions
...@@ -5,13 +5,19 @@ class Hero: ...@@ -5,13 +5,19 @@ class Hero:
self.hp=hp self.hp=hp
self.attack=attack self.attack=attack
yase=Hero('程佳诺',3,2) yase=Hero('程佳诺',3,2)
houyi=Hero('厕所',10000,999) ouyi=Hero('厕所',10000,999)
print('成佳诺的血量为:',yase.hp) print('成佳诺的血量为:',yase.hp)
print('厕所的血量为:',houyi.hp) print('厕所的血量为:',houyi.hp)
def upgrade(): def upgrade(self):
yase.leyel=yase.level+1 self.leyel=self.level+1
yase.hp=yase.hp+50 self.hp=self.hp+50
yase.attack=yase.attack+4 self.attack=self.attack+4
upgrade() houyi=Hero('厕所',10000,999)
upgrade() houyi.upgrade()
print('等级为',houyi.leyel)
print('血量为',houyi.hp)
print('功击力',houyi.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