Commit b1e57551 by BellCodeEditor

save project

parent 66936a2c
Showing with 12 additions and 5 deletions
class hero: class hero:
def __init__(slef,hp,attack): def __init__(slef,name,hp,attack):
slef.level = 1 slef.level = 1
slef.name = name
slef.hp = hp slef.hp = hp
slef.attack = attack slef.attack = attack
yase = hero(1000,20) yase = hero("亚瑟",1000,20)
def upgrade():
yase.level = yase.level + 1
yase.hp = yase.hp +50
yase.attack = yase.attack + 4
print(yase.hp) print(yase.hp)
houyi = hero(500,25) upgrade()
print(houyi.hp) print(yase.hp)
\ 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