15,879,095 members
0.00/5 (No votes)
See more:
For example I have a list of:

`[[1,1,1], [1,1,0], [1,0,1], [1,0,1], [1,1,1], [1,1,0], [1,0,1], [1,0,1], [1,0,1], [1,1,0]]`

I want it to be:

`[[1,1,1,1,1,0], [1,0,1,1,0,1], [1,1,1,1,1,0], [1,0,1,1,0,1], [1,0,1,1,1,0]]`

If you don't get it here is another example:

```[a, b, c, d, e, f, g, h, i, j]
```

```[ab, cd, ef, gh, ij]
```

What I have tried:

```list = [[1, 1, 1], [1, 1, 0], [1, 0, 1], [1, 0, 1], [1, 1, 1], [1, 1, 0], [1, 0, 1], [1, 0, 1], [1, 0, 1], [1, 1, 0]]
newlist = []
for i in range(int(len(list)/2)):
newlist = (''.join(list for n in range(2)))

print(newlist)```
Posted
Updated 8-Nov-22 1:51am

## Solution 1

Try
Python
```l0 = [[1, 1, 1], [1, 1, 0], [1, 0, 1], [1, 0, 1], [1, 1, 1], [1, 1, 0], [1, 0, 1], [1, 0, 1], [1, 0, 1], [1, 1, 0]]
l1 = [ l0[n]+l0[n+1] for n in range(len(l0)) if n%2 == 0 ]
print(l1)```

Comments
Richard MacCutchan 8-Nov-22 11:19am
+5, nice.
CPallini 8-Nov-22 15:57pm
Thank you.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Top Experts
Last 24hrsThis month
 Pete O'Hanlon 185 Graeme_Grant 120 Andre Oosthuizen 85 Dave Kreskowiak 60 Ravi Bhavnani 50
 Pete O'Hanlon 1,695 OriginalGriff 1,270 Graeme_Grant 810 Richard Deeming 743 Dave Kreskowiak 599

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900