Commit 517b547d by BellCodeEditor

auto save

parent f47689a4
Showing with 25 additions and 0 deletions
class Hero:
def __init__(self,name,hp,attack):
self.name=name
self.level=1
self.hp=hp
self.attack=attack
kai=Hero("kai",100,25)
yase=Hero("yase",100,20)
# print("kai的血量",kai.hp)
# print("yase的攻击力",yase.attack)
def upgrade():
kai.level=kai.level+1
kai.hp=kai.hp+20
kai.attack=kai.attack+15
upgrade()
upgrade()
print(kai.level)
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