Commit 77acbbba by BellCodeEditor

save project

parent d429ddc8
Showing with 20 additions and 0 deletions
class hero:
def __init__(self,name,hp,attack):
self.level=1
self.name=name
self.hp=hp
self.attack=attack
yase=hero("亚瑟",3000,4000)
def upgrade():
yase.level=yase.level+1
yase.hp=yase.hp+500
yase.attack=yase.attack+500
upgrade()
upgrade()
houyi=hero("后裔",2500,4500)
print("亚瑟的血量:",yase.hp)
print("后裔的攻击力:",houyi.attack)
\ 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