Commit 0d4114a0 by BellCodeEditor

save project

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