Commit 853cacef by BellCodeEditor

save project

parent 15f56494
Showing with 10 additions and 7 deletions
class Hero:
def __init__(self,name,hp,attack):
self.level = 1
self.leval = 1
self.name = name
self.hp = hp
self.attack = attack
......@@ -9,8 +9,11 @@ daqiao = Hero("大乔",320,25)
xiaoqiao = Hero("小乔",300,24)
libai = Hero("李白",310,25)
hanxin = Hero("韩信",340,24)
print("孙尚香的血量是:",sunshangxiang.hp)
print("大乔的血量是:",daqiao.hp)
print("小乔的血量是:",xiaoqiao.hp)
print("李白的血量是:",libai.hp)
print("韩信的血量是:",hanxin.hp)
\ No newline at end of file
def upgrade():
daqiao.leval = daqiao.leval+1
daqiao.hp = daqiao.hp+50
daqiao.attack = daqiao.attack+1
upgrade()
upgrade()
print("大乔的血量为:",daqiao.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