Commit 4b14d948 by BellCodeEditor

save project

parent ba295c51
Showing with 9 additions and 9 deletions
...@@ -4,13 +4,13 @@ class Hero(): ...@@ -4,13 +4,13 @@ class Hero():
self.hp = hp self.hp = hp
self.name = name self.name = name
self.attack = attack self.attack = attack
def upgrade(self):
self.level = self.level+1
self.hp = self.hp+50
self.attaselfck = self.attack+4
yase = Hero('亚瑟',300,20) yase = Hero('亚瑟',300,20)
houyi = Hero('后裔',240,23) houyi = Hero('后裔',240,23)
print('亚瑟的血量为:',yase.hp) yase.upgrade()
print('后裔的血量为:',houyi.hp) print('血量为',yase.level)
def upgrade(): print('等级为',yase.hp)
yase.level = yase.level+1 print('攻击为',yase.attack)
yase.hp = yase.hp+50 \ No newline at end of file
yase.attack = yase.attack+4
upgrade()
print('亚瑟的血量为:',yase.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