Numbering sequence and range

Hi guys,

I’m struggling a bit with something I’m assured it is a small case, but apparently not for me!
I have a list of elements that I want to set a parameter to based on how many items there is on the list.
[40 elements means a range of numbers 1-41]

In the list, there are also elements that I need two numbers, for instance, “23/24”.
(NK - Type 1 elements in the picture). Further, I need the next index to start on the number 25 and so on.

I manage to do this when its only one element that needs two numbers, but on some occasions there are maybe 20-30 elements that need two numbers. And it is here I’m struggling…

Any suggestion is very much appreciated! :slight_smile:

Here’s a solution with some Python assuming you are just looking for NK - Type 1? It could be scaled to look for other names too if that was needed.

names = IN[0]
check = IN[1]

count = 1
out = []
for n in names:
	if n is check:
		out.append(str(count) + '/' + str(count+1))
		count = count + 2
	else:
		out.append(count)
		count = count + 1
OUT = out

Hope this helps,
Thomas

This is exactly what I wanted! I really need to start learning some Pyhton.

A big thank you Thomas_Corrie! Life saver :slight_smile:

1 Like