# How to do quad panel divisions using python

**URL:** <https://forum.dynamobim.com/t/how-to-do-quad-panel-divisions-using-python/77365>\
**Category:** Lists-Logic\
**Created:** [June 7, 2022, 7:07am UTC](https://forum.dynamobim.com/t/how-to-do-quad-panel-divisions-using-python/77365 "2022-06-07T07:07:24Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![harry\_zhao](https://avatars.discourse-cdn.com/v4/letter/h/ccd318/32.png) [@harry\_zhao](https://forum.dynamobim.com/u/harry_zhao)\
**Post date:** [June 7, 2022, 7:07am UTC](https://forum.dynamobim.com/t/how-to-do-quad-panel-divisions-using-python/77365/1 "2022-06-07T07:07:24Z")

</div>

Hi guys, I’m trying to create a 2 dimensional list from listA, by rearranging the items into sub-lists of 4 items  
like [[1, a, b, 2], [2, b, c, 3], [3, c, d, 4]…[a, apple, banana, b]]

Problem occurs when I try to get the item “listA[ind+1][ind1+1]”  
with this error  
IndexError: list index out of range

So, is my approach wrong? is there another way to do this?

```auto
listA = [[0,1,2,3,4,5,6,7,8,9],["a","b","c","d","e","f",'g',"h","i","j"],["apple","banana","car","duck","egg","fun","go","ha","in","jam"]]
outList=[]
for ind, item in enumerate(listA):
    if ind<len(listA)-1:
        outList2=[]
        for ind1, item1 in enumerate(item):
            if ind1<len(item)-1:
                outList.append([item[ind1], listA[ind+1][ind1], listA[ind+1][ind1+1]])

```

---

<div class="post-metadata">

**Author:** ![Draxl\_Andreas](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/draxl_andreas/32/145744_2.png) [@Draxl\_Andreas](https://forum.dynamobim.com/u/Draxl_Andreas)\
**Post date:** [June 7, 2022, 7:42am UTC](https://forum.dynamobim.com/t/how-to-do-quad-panel-divisions-using-python/77365/2 "2022-06-07T07:42:19Z")

</div>

@harry_zhao ,

i used buildin function _Zip_!

```auto
a = IN[0]
b = IN[1]
c = IN[2]
d = IN[3]

OUT = zip(a,b,c,d)

```

it is still not _python_, maybe it helps

 ![2022-06-07_09h41_19](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/6/c/6c00bcde632fc3dadeebe3107da7c396b351f460.png)

---

<div class="post-metadata">

**Author:** ![harry\_zhao](https://avatars.discourse-cdn.com/v4/letter/h/ccd318/32.png) [@harry\_zhao](https://forum.dynamobim.com/u/harry_zhao)\
**Post date:** [June 7, 2022, 7:48am UTC](https://forum.dynamobim.com/t/how-to-do-quad-panel-divisions-using-python/77365/3 "2022-06-07T07:48:22Z")

</div>

Thanks for your input.  
… The problem is not with the approach, I just had an uneven list🤦‍♂️

---

<div class="post-metadata">

**Author:** ![Draxl\_Andreas](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/draxl_andreas/32/145744_2.png) [@Draxl\_Andreas](https://forum.dynamobim.com/u/Draxl_Andreas)\
**Post date:** [June 7, 2022, 7:49am UTC](https://forum.dynamobim.com/t/how-to-do-quad-panel-divisions-using-python/77365/4 "2022-06-07T07:49:36Z")

</div>

@harry_zhao ,

this outList2 ?

---

<div class="post-metadata">

**Author:** ![harry\_zhao](https://avatars.discourse-cdn.com/v4/letter/h/ccd318/32.png) [@harry\_zhao](https://forum.dynamobim.com/u/harry_zhao)\
**Post date:** [June 7, 2022, 7:51am UTC](https://forum.dynamobim.com/t/how-to-do-quad-panel-divisions-using-python/77365/5 "2022-06-07T07:51:03Z")

</div>

No, it’s with the word sub-list, I had 9 items instead of the 10 items of the other sub-lists.  
So there was a mismatch 😅

---

<div class="post-metadata">

**Author:** ![jacob.small](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/jacob.small/32/161030_2.png) [@jacob.small](https://forum.dynamobim.com/u/jacob.small)\
**Post date:** [June 7, 2022, 7:27pm UTC](https://forum.dynamobim.com/t/how-to-do-quad-panel-divisions-using-python/77365/6 "2022-06-07T19:27:44Z")

</div>

Don’t feel bad… Literally spent 1.5 hours fighting that same issue last week!
