Replace indices that are sequential in list w/ different index

@HS_Kim made this script for my earlier in 2020.

It creates a data tree consisting of 0’s and 1’s. However, I would like to know how to find each time a 0 occurs, say 3 times in a row, and replace that with a 2, and 4 times in a row would be a 3. So in the new list, it would consist of 0, 1, 2, and maybe 3’s.2021.02.18_mcneel_forum_01.gh (14.5 KB)

I was sure it was simple but had some minutes finding one solution. Is it that you want ? Text is your friend.


2021.02.18_mcneel_forum_02.gh (11.9 KB)

A like, a solution or an answer will be appreciated. Kindness is a good money for free helping.

1 Like

Sorry @laurent_delrieu . Yes, you’re solution was exactly what I needed! Things got busy for me the last couple days, and I didn’t remember to get back to this.

1 Like