Discuss / Python / 喜羊羊

喜羊羊

Topic source

雲☁

#1 Created at ... [Delete] [Delete and Lock User]
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()

  • 1

Reply