Commit 97b29567 by BellCodeEditor

save project

parent a25710bf
Showing with 11 additions and 8 deletions
......@@ -4,12 +4,15 @@ class Hero:
self.name=name
self.hp=hp
self.attack=attack
def upgrade():
yese.level=yese.level+1
yese.hp=yese.hp+50
yese.attack=yese.attack+4
def upgrade(self):
self.level=self.level+1
self.hp=self.hp+50
self.attack=self.attack+4
yese=Hero("垭瑟",300,20)
houyi=Hero("后羿",240,23)
print("垭瑟血量:",yese.hp)
upgrade()
upgrade()
print("垭瑟血量:",yese.hp)
\ No newline at end of file
print("后羿血量:",houyi.hp)
yese.upgrade()
houyi.upgrade()
print("垭瑟血量:",yese.hp)
print("后羿血量:",houyi.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