Merge elements of sublists

Hi all,

how do I achieve this?

Input:
list1 = [[1, 20, 30],
[40, 29, 72],
[119, 123, 115]]

list2 = [[29, 57, 64, 22],
[33, 66, 88, 15],
[121, 100, 15, 117]]

Output: [[1, 20, 30, 29, 57, 64, 22],
[40, 29, 72, 33, 66, 88, 15],
[119, 123, 115, 121, 100, 15, 117]]

Thank you!

Join the lists so you have the two similarly structured sublists and the transform that list to group each index together. Then you can flatten the indexed sublists.

You could also use AddItemToEnd/Front to add each index from one sublist to the other and then flatten.

2 Likes

Would that still work if I have inputs like this? As you can see I have the same amount of sublists in both lists, just the number of items stored in each sublist will vary.

hi


cordially
christian.stan

1 Like

Thank you both! Makes sense now. Can’t accept 2 solutions :frowning:

1 Like

No problem, I’m not looking to reach a number of solutions (Contributed by Mr. Nick)

Sincerely
christian.stan

1 Like