Skip to content
Advertisement

Grouping a list of tuple which has two lists based on the second list

I have a sequence is like this,

seq = [[["A","AA","AB"],[0,1,2,3]], [["B","BB","BC"],[1,2,3]], [["C","CA","CB"],[0,1,2,3]]]

I wanted to convert this to something like below

[[['A', 'AA', 'AB', 'C', 'CA', 'CB'], [0, 1, 2, 3]], [['B', 'BB', 'BC'], [1, 2, 3]]]

I tried but I am getting like below. Can someone help in achieving the correct results.

JavaScript

Advertisement

Answer

JavaScript
User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement