def __init__(self,kind = "cheese"):
self.set_kind(kind)
return
def set_kind(self,kind):
possible_ingredients = self.__known_kinds(kind)
if possible_ingredients == False:
return False
else:
self.kind = kind
self.needed_ingredients = possible_ingredients以上代码都是Omelet类中的函数AttributeError: 'Omelet' object has no attribute '_Omelet__known_kinds'如此报错求助!(鞠躬)def __known_kinds(self,kind): if kind == "cheese": return{"eggs":2,"milk":1,"cheese":1} elif kind == "mushroom": return{"eggs":2,"milk":1,"cheese":1,"mushroom":2} elif kind == "onion": return{"eggs":2,"milk":1,"cheese":1,"onion":1} else: return False
添加回答
举报
0/150
提交
取消