我正在 python 3.7 上尝试一个小项目,但似乎无法让它工作。我想找到存储在包含许多列表的对象中的给定列表。我确定我的编码很差,因为我在这方面几乎是新手!
my_choice = ["a", "b", "c"]
reciepe1 = [["a", "b", "c"], "d", "e", "f"]
reciepe2 = ["x", "y", "z"]
menu = [reciepe1, reciepe2]
for my_choice in menu:
if my_choice in reciepe1:
print(reciepe1)
elif my_choice in reciepe2:
print(reciepe2)
慕桂英3389331
相关分类