Commit 98581ad2 by BellCodeEditor

save project

parent 2108a622
Showing with 6 additions and 6 deletions
......@@ -4,11 +4,11 @@ class Hero:
self.hp=hp
self.level=level
self.attack=attack
def upgrade(self):
self.hp=self.hp+50
self.level=self.level+1
self.attack=self.attack+5
yase=Hero('亚瑟',100,1,100)
xiaobei=Hero('小贝',1,1,2)
def yase_upgrade():
yase.hp=yase.hp+50
yase.level=yase.level+1
yase.attack=yase.attack+5
yase_upgrade()
print(yase.level,yase.hp,yase.attack)
yase.upgrade()
print(yase.name,yase.hp,yase.level,yase.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