Commit d5605bb0 by BellCodeEditor

save project

parent 1321c0f0
Showing with 10 additions and 6 deletions
class Hero:
def __init__(self,name,hp,attack):
self.hp=hp
self.level=2
self.level=1
self.attack=attack
self.name=name
def upgrade(self):
self.level=self.level+1
self.hp=yese.hp+50
self.attack=yese.attack+3
yese=Hero("亚瑟",300,20)
print(yese.hp)
houyi=Hero("后羿",240,25)
print(houyi.hp)
def upgrade():
yese.hp=yese.hp+50
yese.attack=yese.attack+3
upgrade()
upgrade()
yese.upgrade()
yese.upgrade()
print(yese.hp)
print(yese.level)
print(yese.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