I have to lists of dictionaries:
basket = [{"size": "big", "food": "cheese"}, {"size": "small", "food": "cherries"}]
fruits = [{"size": "small", "food": "blueberries"}, {"size": "small", "food": "cherries"}]
I need to compare these two lists of dicts by the "food" key. If a fruit is not in the basket list, I want to append the whole dictionary into the basket list.
I was trying to do it with filter(), but I cannot visualize a scenario where I can call basket[food] and iterate through the fruits lists at the same time.