Commit 4858aea9 by BellCodeEditor

save project

parent 779f935c
Showing with 9 additions and 8 deletions
class hero:
def __init__(self,name,hp,attack):
self.level=1
self.hp=hp
self.name=name
self.attack=attack
yase=hero("垭瑟",300,20)
houyi=hero("后裔",250,23)
print("血量",yase.hp)
print("攻击力",yase.attack)
print("血量",houyi.hp)
print("攻击力",houyi.attack)
def upgrade():
yase.hp=yase.hp+50
yase.level=yase.level+1
yase.attack=yase.attack+4
upgrade()
upgrade()
print("垭瑟血量",yase.hp)
print("垭瑟攻击力",yase.attack)
......
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