Commit 24ce2715 by BellCodeEditor

save project

parent cc1f371f
Showing with 14 additions and 8 deletions
class hero:
def __init__(self,name,hp,attack):
def __init__(self,name,level,hp,attack):
self.level=level
self.hp=hp
self.attack=attack
self.name=name
LuBan=hero('鲁班',2500,200)
HouYi=hero('后羿',3000,230)
LuBan=hero('鲁班',1,2500,200)
HouYi=hero('后羿',1,3000,230)
print(LuBan.name)
print(LuBan.level)
print(LuBan.hp)
print(LuBan.attack)
def a():
LuBan.level+=1
LuBan.hp+=500
LuBan.attack+=100
a()
print(LuBan.name)
print(LuBan.level)
print(LuBan.hp)
print(LuBan.attack)
print(' ')
print(HouYi.name)
print(HouYi.hp)
print(HouYi.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