Commit ad93c9e7 by BellCodeEditor

save project

parent 3829ef9a
Showing with 8 additions and 7 deletions
......@@ -4,15 +4,16 @@ class Hero:
self.name = name
self.hp = hp
self.attack = attack
def upgrade(self):
self.level+=1
self.hp+=50
self.attack+=4
yase = Hero("垭瑟",300,20)
houyi = Hero("后羿",250,23)
def upgrade():
yase.level+=1
yase.hp+=50
yase.attack+=4
upgrade()
upgrade()
yase.upgrade()
houyi.upgrade()
print(yase.level)
print(yase.attack)
print(yase.hp)
print(houyi.hp)
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