Commit caf5d2af by BellCodeEditor

save project

parent 2b711a77
Showing with 12 additions and 6 deletions
class TheFirstDemo:
def __init__(self):
self.hp1=1
self.hp2=300
self.hp3=20
yese=TheFirstDemo()
print(yese.hp2)
def __init__(self,hp,attack,name):
self.level=1
self.hp=hp
self.attack=attack
self.name=name
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