Commit b4556091 by BellCodeEditor

save project

parent 22354288
Showing with 16 additions and 0 deletions
class Hero:
def __init__(self,name,experience,attack):
self.level=0
self.name=name
self.experience=experience
self.attack=attack
def upgrade(self):
self.level+=1
self.experience+=1
self.attack+=2
Yase=Hero("亚瑟",0,2)
Houyi=Hero("后羿",0,1)
Yase.upgrade()
Houyi.upgrade()
print(Yase.level,Yase.attack)
print(Houyi.level,Houyi.experience)
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