0

I have 2 lists as input:

list_A = [["Holiday Inn", 3], ["Marriott Hotels", 4], ["Aloft Hotels", 2]]
list_B = [["Marriott Hotels", 10], ["Motel 6", 7], ["Holiday Inn", 8]]

I want one big list as output:

output_list = [ ["Holiday Inn", [3,8]], ["Aloft Hotels", [2]], ["Marriott Hotels", [4, 10]], ["Motel 6", [7]] ]

Output list need not be in any order. I am looking for a neat way to do it in Python. I can scan each list multiple times to achieve the above. But, my input lists are very very large. Any suggestions?

Thanks!, PD.

user1717931
  • 2,263
  • 4
  • 27
  • 38

0 Answers0