All Posts Create a Post  
0
votes
108
views
Combine two lists in one dictionary that takes unique values as keys
Posted at 4 months, 1 week ago / May 20, 2021, noon

I have this two lists, with same len: owner=["John","John","Mark","Bill","John","Mark"] restaurant_number=[0,2,3,6,9,10] I want to turn that into a dict that informs the restaurant_number of each owner: d={"John":[0,2,9],"Mark":[3,10],"Bill":[6]} I could do it …

172 5 5 0