Commit 6820c428 by BellCodeEditor

save project

parent f47689a4
Showing with 23 additions and 0 deletions
class Hero:
def __init__(self,name,hp,attack):
self.level=1
self.name=name
self.hp=hp
self.attack=attack
def upg(self):
self.level=self.level+1
self.hp=self.hp+50
self.attack=self.attack+4
yase=Hero("亚瑟",300,20)
houyi=Hero("sd",200,30)
houyi.upg()
def sc():
print("sd的等级:",houyi.level)
print("sd的血量:",houyi.hp)
print("sd的攻击:",houyi.attack)
sc()
upg()
sc()
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