The breakfast café logs orders as (name, dish), and some people order the same dish twice. Write who_ordered(orders) to return {dish: [people who ordered it]}: dishes in the order first seen, people listed once each, alphabetically. No orders gives {}.
who_ordered([("Mia", "pancakes"), ("Leo", "eggs"), ("Mia", "pancakes"), ("Ann", "pancakes")])→{'pancakes': ['Ann', 'Mia'], 'eggs': ['Leo']}who_ordered([])→{}def who_ordered(orders):
people = {}
for person, dish in orders:
# your code here: add the person to this dish's set (giving the dish an empty set first)
pass
# your code here: loop again and turn each dish's set into a sorted list
return people
Run tries the examples. When they look right, Submit.