Hi All. I have the code below. Problem is it replaces the comments with the last item on the list. How do I get it so it finds and replaces the comment list individually?

Hello, here is another possibility,

with numbering of different comments

code block

```
K;
L;
B;
com;
res=[];
result=[Imperative]
{
for (i in 0..(K-1))
{
for (j in 0..(L[i]-1))
{
res[i][j]=com[i][j]+" "+B[j];
}
}
return res;
};
```

Cordially

christian.stan

1 Like

The if statement is necessary because it needs to identify if there are comments there, and if there are comments do the one otherwise do the other. But annoyingly its replacing everything on the last item on the list. I tried to replace each individually but it doesnt work. @christian.stan it definitely needs the if. I need to establish if a comment is empty. Please see the file

renamelBEAMS.dyn (37.2 KB)

I send a number preceded by a space for each comment then erase the space character ββif itββ is at the beginning of the chain with the TrimLeadingWhitespace node (which takes care of doing the work if necessary) of phantom way the ββifββ is applied.

Cordially

christian.stan

is there a way to do the reverse, say instead of B1-a-1,2,3 etc we have B1-1,A,b,c?

Hello, I did not understand very well, you may be looking for something in this direction

```
n_data=DSCore.List.Count(L_num);
n_ent=Math.Floor(n_data/26);
le="a"..#26..1;
lr="a"..#(n_data%26)..1;
res=DSCore.List.Flatten(
DSCore.List.AddItemToEnd(lr,DSCore.List.OfRepeatedItem(le,n_ent)));
```

edit: I tried a python solution (not necessarily the most efficient)

```
import math
Number=IN[0]
letters='abcdefghijklmnopqrstuvwxyz'
n=math.ceil(Number/26)
list=n*letters
OUT = [i for i in list[:Number]]
```

Cordially

christian.stan