Commit 23db7ed0 by BellCodeEditor

save project

parent 28715162
Showing with 11 additions and 7 deletions
class Hero():
def __init__(self):
def __init__(selfname,hp,attack):
self.level = 1
self.hp=300
self.attack=20
yase=Hero()
print(yase.hp)
self.name=name
self.hp=hp
self.attack=attack
yase=Hero("亚瑟",300,20)
houyi=hero("后羿",260,24)
print("亚瑟的生命值是",yase.hp)
print("亚瑟的攻击值是",yase.attack)
print("后羿的生命值是",houyi.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