Commit 1ed1e511 by BellCodeEditor

save project

parent f47689a4
Showing with 24 additions and 0 deletions
class Hero:
def __init__ (self,name,hp,attck):
self.level=1
self.name=name
self.hp=hp
self.attck=attck
def upg(self):
self.level=self.level+1
self.hp=self.hp+45
self.attck=self.attck+5
yase=Hero('SB',300,20)
houyi=Hero('NMD',300,20)
print('SB:',yase.hp)
print('NMD:',houyi.hp)
houyi.upg()
def sc():
print("NMD hp:",houyi.hp)
print("NMD houyi.attck:",houyi.attck)
sc()
houyi.upg()
\ 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