# How to combine 2 lists in a specific order

**URL:** <https://forum.dynamobim.com/t/how-to-combine-2-lists-in-a-specific-order/34131>\
**Category:** Revit\
**Created:** [March 28, 2019, 11:02pm UTC](https://forum.dynamobim.com/t/how-to-combine-2-lists-in-a-specific-order/34131 "2019-03-28T23:02:13Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![raymond.humes](https://avatars.discourse-cdn.com/v4/letter/r/db5fbb/32.png) [@raymond.humes](https://forum.dynamobim.com/u/raymond.humes)\
**Post date:** [March 28, 2019, 11:02pm UTC](https://forum.dynamobim.com/t/how-to-combine-2-lists-in-a-specific-order/34131/1 "2019-03-28T23:02:13Z")

</div>

Hi I have 2 lists and I’d like to combine them so that the wall at index 0 in my image is after quad 0 in the top list and so the wall at index 1 is inserted after index item 1 in the above list and so on is there any way to do that in python or dynamo?

![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/3/9/39c522d035da27a6a88562cac1a3d06dc7e09765.png)

---

<div class="post-metadata">

**Author:** ![julian.venczel](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/julian.venczel/32/29998_2.png) [@julian.venczel](https://forum.dynamobim.com/u/julian.venczel)\
**Post date:** [March 28, 2019, 11:47pm UTC](https://forum.dynamobim.com/t/how-to-combine-2-lists-in-a-specific-order/34131/2 "2019-03-28T23:47:35Z")

</div>

Yes you could put them both into a python node then have some loop with an iterator and add an item from each list alternating based on whether the iterator is even or odd. It would look something like:

list1 = IN[0]

list2 = IN[1]

newlist=

a = 0

b = 0

x=0

for x in range ((len(list1)+len(list2)):  
if (x%2 == 0):  
newlist.append(list1(a))  
a = a+1  
x = x+1  
else:  
newlist.append(list2(b))  
b = b+1  
x = x+1  
OUT = newlist

Syntax might be wrong, I haven’t tried it out

---

<div class="post-metadata">

**Author:** ![kennyb6](https://avatars.discourse-cdn.com/v4/letter/k/7ba0ec/32.png) [@kennyb6](https://forum.dynamobim.com/u/kennyb6)\
**Post date:** [March 29, 2019, 1:04am UTC](https://forum.dynamobim.com/t/how-to-combine-2-lists-in-a-specific-order/34131/3 "2019-03-29T01:04:23Z")

</div>

Easier method is using List.Create and then a Transpose node:

 ![transposeexample](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/b/5/b5535cbf45b379110cb26def44ec55a8689805b6.png)

and another python example:  
`OUT = [[a,b] for a,b in zip(IN[0],IN[1])]`  
 ![python%20transpose](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/8/d/8d8e91d10743f08e7f2da487bc5c78a0c69388a7.png)

Edit: If you need them all in the same list, you can just flatten afterwards.

---

<div class="post-metadata">

**Author:** ![raymond.humes](https://avatars.discourse-cdn.com/v4/letter/r/db5fbb/32.png) [@raymond.humes](https://forum.dynamobim.com/u/raymond.humes)\
**Post date:** [April 1, 2019, 3:18pm UTC](https://forum.dynamobim.com/t/how-to-combine-2-lists-in-a-specific-order/34131/4 "2019-04-01T15:18:25Z")

</div>

Thanks this works.
