I am wondering if there is a more elegant/pythonic way to do the following. Suppose I have a nested dictionary:
orders = {'peter': {'food': 'pizza', 'drink': 'soda'}, 'paul': {'food': 'taco', 'drink': 'soda'},'mary': {'food': 'pizza', 'drink': 'water'}}
and I want to obtain a list containing the unique 'food' items for each person, I.e. ['pizza', 'taco']
is this the easiest way to do it?
foodList = []
for i in orders.keys():
foodList.append(orders[i]['food'])
s = set(foodList)