Commit 4c888b31 by BellCodeEditor

save project

parent d2228e67
Showing with 9 additions and 9 deletions
class Hero:
def __init__(self):
self.level=1
self.hp=300
self.attack=20
yase = Hero()
print("亚瑟的血量为",yase.hp)
print("亚瑟的功击力为",yase.attack)
print("亚瑟的等级为",yase.level)
\ No newline at end of file
def __init__(self,name,hp,attack):
self.name=name
self.hp=hp
self.attack=attack
houyi=Hero("后羿",500,50)
yase=Hero("亚瑟",400,30)
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