Commit 78c39256 by BellCodeEditor

save project

parent 13c9e284
Showing with 23 additions and 4 deletions
class Hero:
def __init__(self):
def __init__(self,name,hp,attack):
self.level=1
self.hp=300
self.attack=20
self.name=name
self.hp=hp
self.attack=attack
yase=Hero()
def sheng(self):
self.level=self.level+1
self.hp=self.hp+10
self.attack=self.attack+5
yase=Hero("亚瑟",300,20)
hoyi=Hero("后羿",250,25)
yase.sheng()
print(yase.hp)
yase.sheng()
print(yase.hp)
hoyi.sheng()
print(hoyi.hp)
hoyi.sheng()
print(hoyi.hp)
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