So, I am trying to solve this problem where I have to return a dictionary of all people who went on dates.
For example, this input:
[
["john", "amy"],
["abby", "john"],
["john", "michael"],
["michael", "chris"],
]
Should output:
{
"john": set(["amy", "abby", "michael"]),
"amy": set(["john"]),
"abby": set(["john"]),
"michael": set(["john", "chris"]),
"chris": set(["michael"]),
}
but I have no idea how I can save the names and then insert it into a dictionary. I've tried looping through the list twice, but no luck.
Below, is the function that I've been using to return the necessary dictionary.
def return_all_dates(people_who_went_on_dates):
pass