myDict = {'Fruits': ['Apples', 'Oranges', 'Bananas'], 'Meats': ['Beef', 'Chicken', 'Pork']}
myDict2 = {'FoodType1': ['Fruits'], 'FoodType2': ['Meats']}
What I am trying to do is this:
food = myDict2.get('FoodType1')
if 'Oranges' in myDict.get(food):
return "True!"
I know the issue is that the variable 'food' is ['Fruits'], which is a mutable list. Is there a better way to do the if check if I must use those two dicts?
I add to myDict2
using myDict2.append()
and it looks to be adding them as lists. How can I add them as strings?