Commit 537421bf by BellCodeEditor

save project

parent caa61f88
Showing with 9 additions and 4 deletions
......@@ -4,10 +4,15 @@ class Hero:
self.name=name
self.hp=hp
self.attack=attack
yese=Hero("亞瑟",300,20)
def upgrade():
def upgrade(self):
yese.level=yese.level+1
yese.hp=yese.hp+50
yese.attack=yese.attack+4
upgrade()
upgrade()
houyi=Hero("后羿",240,23)
houyi.upgrade()
print(houyi.level)
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