Commit 7ccdc1b3 by BellCodeEditor

save project

parent a1cf4152
Showing with 13 additions and 9 deletions
class hero: class hero:
def __init__(self): def __init__(self,name,hp,attack):
self.level=1 self.level=1
self.hp=300 self.name = name
self.attack=20 self.hp=hp
self.attack=attack
yase = hero()
print("yase的血量值为:",yase.hp) def upgrade():
print("yase的攻击力为:",yase.attack)
yase = hero("亚瑟",300,20)
print("亚瑟的初始血量为为:",yase.hp)
upgrade()
upgrade()
print("升级2次后,亚瑟的血量为为:"yase.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