Commit 6bbec6e1 by BellCodeEditor

save project

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