suppose I have a list
list1 = [[(0, 1), (1, 1)], [(2, 3), (1, 2)], [(4, 5), (1, 3)]]
list2 = [[(1, 2)], [(3, 4)], [(5, 6)]]
Now I need to combine the specific elements of each list in a way such that in list1 has (0, 1) as the first element of the first sublist and list2 has (1, 2) as the first element so we would combine them to get an element (0, 2)
Similarly first element of the second sublist of list1 is (2, 3) and second element of list2 is (3, 4)
so we would combine them to get (2, 4)
The resultant output list would be:
result = [[(0, 2)], [(2, 4)], [(4, 6)]]
Use
zip: