Commit d312b0a7 by BellCodeEditor

save project

parent 22354288
Showing with 20 additions and 0 deletions
class Hero():
def __init__(self,name,level,hp,attack):
self.name=name
self.level=level
self.hp=hp
self.attack=attack
def up(xc):
xc.level=xc.level+1
xc.hp=xc.hp+6
xc.attack=xc.attack+20
Lan=Hero('澜',1,100,400)
WuKong=Hero('孙悟空',1,220,210)
XiaoLuBan=Hero('小鲁班',1,330,190)
print(Lan.name,Lan.level,Lan.hp,Lan.attack)
Lan.up()
print(Lan.name,Lan.level,Lan.hp,Lan.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