Commit caf5d2af by BellCodeEditor

save project

parent 2b711a77
Showing with 12 additions and 6 deletions
class TheFirstDemo: class TheFirstDemo:
def __init__(self): def __init__(self,hp,attack,name):
self.hp1=1 self.level=1
self.hp2=300 self.hp=hp
self.hp3=20 self.attack=attack
yese=TheFirstDemo() self.name=name
print(yese.hp2) y1=TheFirstDemo(300,20,"yese")
y2=TheFirstDemo(250,23,"houyi")
print("亚瑟的属性值为:","血量:",y1.hp,"攻击力:",y1.attack)
print("后羿的属性值为:","血量:",y2.hp,"攻击力:",y2.attack)
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