Commit f33a6baf by BellCodeEditor

save project

parent 15353410
Showing with 11 additions and 4 deletions
class hero(): class hero():
def __init__(self,name,hp,attack): def __init__(self,name,level,hp,attack):
self.name=name self.name=name
self.hp=hp self.hp=hp
self.attack=attack self.attack=attack
yase=hero('亚瑟',450,10) self.level=level
print(yase.name) def sj(self):
\ No newline at end of file self.hp+=30
self.attack+=10
self.level+=1
yase=hero('亚瑟',1,450,10)
yase.sj()
print(yase.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