Commit ea05f3d3 by BellCodeEditor

save project

parent 22354288
Showing with 19 additions and 0 deletions
class hero:
def __init__(slef,name,hp,attack):
slef.level = 1
slef.name = name
slef.hp = hp
slef.attack = attack
def upgrade(slef):
slef.level = slef.level + 1
slef.hp = slef.hp +50
slef.attack = slef.attack + 2
houyi = hero("后羿",300,20)
print(houyi.hp)
houyi.upgrade()
print(houyi.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