class Human(object): def __init__(self,height,weight,appearance): self.height = height self.weight = weight self.appearance = appearance def find_girlfriend(self): if (185 <= self.height <= 190) and 70 <= self.weight <= 80 and self.appearance == 'good': print("你可以找到女朋友") else: print("你不能找到女朋友") def eat(self): if (185 <= self.height <= 190) and 70 <= self.height <= 80: print("你可以吃") else: print(" 你别吃了")喜羊羊 = Human(188, 75, "good")沸羊羊 = Human(185,80,"bad")喜羊羊.find_girlfriend()喜羊羊.eat()沸羊羊.find_girlfriend()沸羊羊.eat()
Sign in to make a reply
雲☁