Commit ba4a6107 by BellCodeEditor

auto save

parent f47689a4
Showing with 18 additions and 0 deletions
class hero:
def __init__(self,name,hp,attack):
self.hp=hp
self.level=4
self.attack=attack
self.name=name
def levelup(self):
self.level+=1
self.hp+=20
self.attack+=15
print("恭喜"+self.name+"升级了!")
kai=hero("kai",300,25)
direnjei=hero("direnjei",250,30)
kai.levelup()
print(kai.attack)
print(direnjei.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