i am trying to sort the items in a list as below and create a new list. Each list have 20 items.
get the items in the list-0 at index 0 - 4,
get the items in the list-1 at index 5 - 9,
get the items in the list-2 at index 10 - 13,
get the items in the list-3 at index 14 - 19
You are trying to get a list for each index number?
So all the 0’s in one list?
Try this:
numbers = IN[0]
groups = []
for number in numbers:
# Search for a sublist that starts with the current number
found = False
for group in groups:
if group[0] == number:
group.append(number) #Append number to correct list
found = True
break
groups.append([number]) # Make new list if you can't find one. :)
OUT = groups