Commit db0b639c by BellCodeEditor

save project

parent d6c81a0f
Showing with 18 additions and 0 deletions
class Hero:
def __init__(self,name,hp,attack):
self.name=name
self.level=1
self.hp=hp
self.attack=attack
def sj(self):
self.level=self.level+1
self.hp=self.hp+10
self.attack=self.attack+1
hjx=Hero("黄锦轩",9.1,10)
hmz=Hero("何民正",110,1)
hmz.sj()
hjx.sj()
hjx.sj()
print(hjx.level,hjx.hp,hjx.attack)
print(hmz.level,hmz.hp,hmz.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