Dear Dynamo Specialists,
Can anyone help me?
How to create sublists when the value is 0, so make sublist at value?
Dear Dynamo Specialists,
Can anyone help me?
How to create sublists when the value is 0, so make sublist at value?
Here is a Python solution:
liste = IN[0]
def create_sub(liste):
res = []
for i,x in enumerate(liste):
for el in liste:
if el ==0:
index_el = liste.index(el)
erste = liste[:index_el]
erste.insert(0,0)
res.append(erste)
liste = liste[index_el+1:]
if 0 not in liste:
res.append(liste)
final = res[len(res)-1].insert(0,0)
yield res
OUT = create_sub(liste)
Thanks man!!!
Nice solution!!