How can i create a list of numbers with a repetitive gap in between, for example numbers from o to 100 with a 10 numbers then 10 gaps then 10 numbers…etc. (0,1,2,3,4,5,6,7,8,9,10,20,21,22,23,24,25,26,27,28,29,30,40,41,42…etc)
Hi @mohamed.elnemr !
Here is two ways to do it : You can use the List.Sublist node or some ranges
4 Likes
List.Sublists suggested by @Francois_Labonne would be the best approach according to me.
If you want a couple more options …
4 Likes
That ‘range by 20, add range by 1, flatten’ though… beautiful.
3 Likes
hello
another solution with Python
import sys
gaps = IN[0]
func = lambda x : [] if x % (gaps * 2) == 0 else range(x - gaps, x + 1, 1)
OUT = sum([ func(x) for x in range(0, 200, gaps) ], [])
2 Likes