List Merge

Am trying to merge two list in the order displayed below. Any help will be appreciated.

Hi @Cesar_Escalante

One of the possible way is to join both list then flatten then use List.Sort node and then List.Chop length by 5.

@Cesar_Escalante

Using Python, option 1:

def MergeSort(lst1,lst2):
	MergedList=[]
	for index,i in enumerate(lst1):
		MergedList.append(i+lst2[index])
		MergedList[index].sort()
	return MergedList

OUT=MergeSort(IN[0],IN[1])

Option 2:

MergedList=[i+IN[1][index] for index,i in enumerate(IN[0])]
for i in MergedList:
	i.sort()
OUT=MergedList
5 Likes

Here is a way just using nodes.

2 Likes

Ultra simple approach:

9 Likes

Hey everyone,

I am having the same question about merging lists. Only my list does not consit of a,b,c,d or 1,2,3,4 but random values like d,y,h,w which can’t be sorted, because I need the original order - any ideas?