Commit ebfac153 by BellCodeEditor

save project

parent 7fbff3ca
Showing with 11 additions and 10 deletions
......@@ -4,17 +4,18 @@ class Hero:
self.name = name
self.hp = hp
self.attack = attack
def upgrade(self):
self.leval = self.leval+1
self.hp = self.hp+50
self.attack= self.attack+4
wuzetian = Hero("武则天",300,20)
wangzhaojun = Hero("王昭君",340,23)
sunshangxiang = Hero("孙尚香",320,21)
yuji = Hero("虞姬",310,22)
hanxin = Hero("韩信",330,24)
def upgrade():
wuzetian.leval = wuzetian.leval+1
wuzetian.hp = wuzetian.hp+50
wuzetian.attack= wuzetian.attack+4
upgrade()
upgrade()
print("武则天的血量为:",wuzetian.hp)
\ No newline at end of file
wuzetian.upgrade()
print("武则天的等级为:",wuzetian.leval)
print("武则天的血量为:",wuzetian.hp)
print("武则天的攻击力为:",wuzetian.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