Convert list of tuples w/ lenght 5 to dictionary in Python
Question: what if I have a tuple list like this:

    
    
    list =  [('Ana', 'Lisbon', 42195, '10-18', 2224),
            ('Eva', 'New York', 42195, '06-13', 2319),
            ('Ana', 'Tokyo', 42195, '02-22', 2403),
            ('Eva', 'Sao Paulo', 21098, '04-12', 1182),
            ('Ana', 'Sao Paulo', 21098, '04-12', 1096),
            ('Dulce', 'Tokyo', 42195, '02-22', 2449),
            ('Ana', 'Boston', 42195, '04-20', 2187)]
    

How can I convert this to a dictionary like this one?

    
    
    dict = {'Ana': [('Ana', 'Lisboa', 42195, '10-18', 2224),('Ana', 'Toquio',42195, '02-22', 2403), 
          ('Ana', 'Sao Paulo', 21098, '04-12', 1096),('Ana', 'Boston', 42195, '04-20', 2187)],
          'Dulce': [('Dulce', 'Toquio', 42195, '02-22', 2449)],
          'Eva': [('Eva', 'Nova Iorque', 42195, '06-13', 2319), 
          ('Eva', 'Sao Paulo', 21098, '04-12', 1182)]}
    


Answer: You can just loop through the list like this:

    
    
    from collections import defaultdict
    combined = defaultdict(list)
    for i in list1:
      combined[i[0]].append(i)
    

