Commit e8f7b598 by BellCodeEditor

save project

parent 535b816c
Showing with 9 additions and 9 deletions
......@@ -4,14 +4,14 @@ class hero:
self.name=name
self.hp=hp
self.attack=attack
def urgrade_yase():
yase.level=yase.level+1
yase.hp=yase.hp+1
yase.attack=yase.attack+1
def upgrade(self):
self.level=self.level+1
self.hp=self.hp+1
self.attack=self.attack+1
yase=hero("亚瑟",300,20)
houyi=hero("后羿",250,23)
print("亚瑟的血量是",yase.hp)
urgrade_yase()
urgrade_yase()
print("升级两次后,亚瑟的血量是",yase.hp)
\ No newline at end of file
houyi.upgrade()
print("等级为",houyi.level)
print("血量为",houyi.hp)
print("攻击为",houyi.attack)
\ 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