There might be a similar ask to this one in the past, however wasn't able to find the one that I was looking for,
Input = [('Icecream', 'Vanilla'), ('Icecream', 'Chocolate'), ('Icecream', 'Strawberry')]
Output = [('Icecream', ['Vanilla', 'Chocolate', 'Strawberry'])]
Basically, given a list of tuples, need to merge the tuples to form a tuple list without duplicates where the second element in each tuple must be a list.
The Input list might contain more items like below,
Input = [('Icecream', 'Vanilla'), ('Icecream', 'Chocolate'), ('Icecream', 'Strawberry'), ('Veggie', 'Carrot'), ('Milk', 'whole'), ('Milk', 'formula')]
Output = [('Icecream', ['Vanilla', 'Chocolate', 'Strawberry']), ('Veggie', ['Carrot']), ('Milk', ['whole', 'formula'])]