Commit 1116541e by BellCodeEditor

save project

parent 1da6b782
Showing with 9 additions and 0 deletions
......@@ -4,7 +4,16 @@ class Hero:
self.name=name
self.hp= hp
self.attack= attack
def shengji(self):
self.hp=self.hp+50
self.attack=self.attack+50
self.level=self.level+1
daqiao=Hero("大乔",100,95)
xiaoqiao=Hero("小乔",100,90)
zhouyu=Hero("周瑜",100,70)
daqiao.shengji()
zhouyu.shengji()
xiaoqiao.shengji()
print("小乔的血量:",xiaoqiao.hp)
print("周瑜的血量:",zhouyu.hp)
print("大乔的血量:",daqiao.hp)
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