Commit 6bbec6e1 by BellCodeEditor

save project

parent 2764b61f
Showing with 13 additions and 8 deletions
class Hero:
def __init__(self):
def __init__(self,name,hp,attack):
self.level=1
self.hp=300
self.attack=35
yase = Hero()
print("亚瑟的等级是"+str(yase.level))
print("亚瑟的血量是"+str(yase.hp))
print("亚瑟的攻击力是"+str(yase.attack))
\ No newline at end of file
self.name=name
self.hp=hp
self.attack=attack
yase = Hero('亚瑟',300,35)
houyi=Hero("后羿",240,40)
print(yase.name+"的等级是"+str(yase.level))
print(yase.name+"的血量是"+str(yase.hp))
print(yase.name+"的攻击力是"+str(yase.attack))
print(houyi.name+"的等级是"+str(houyi.level))
print(houyi.name+"的血量是"+str(houyi.hp))
print(houyi.name+"的攻击力是"+str(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