title: How to combine lists in list accordingly. (without numpy)
body: <p>I have list of lists of lists and need to combine the inner lists accordingly.</p>
  <p>For example:</p>
  <p>1.<code> mylist=[[[1]], [[2]]]</code></p>
  <p>2.</p>
  <pre><code>mylist= [[[1, 1, 1], [1, 1, 1], [1, 1, 1], [1, 1, 1]],
           [[2, 2, 2], [2, 2, 2], [2, 2, 2], [2, 2, 2]],
           [[3, 3, 3], [3, 3, 3], [3, 3, 3], [3, 3, 3]]]
  </code></pre>
  <p>(in short-<code>[[[1]*3]*4, [[2]*3]*4, [[3]*3]*4]</code>)</p>
  <p>Expected output-</p>
  <ol>
  <li><code>[[[1, 2]]]</code></li>
  <li></li>
  </ol>
  <pre><code>[[[1, 2, 3], [1, 2, 3], [1, 2, 3]],
   [[1, 2, 3], [1, 2, 3], [1, 2, 3]],
   [[1, 2, 3], [1, 2, 3], [1, 2, 3]],
   [[1, 2, 3], [1, 2, 3], [1, 2, 3]]]
  </code></pre>
  <p>(in short-<code>[[[1, 2, 3]]*3]*4</code>)</p>
  <p>This is what I have untill now-</p>
  <pre><code>def combine_channels(mylist):
      elements = [[] for _ in range(len(mylist[0]))]
      for l1 in mylist:
          for idx, l2 in enumerate(l1):
              elements[idx] += l2
  
      return [elements]
  </code></pre>
  <p>The problem is that the output is (for input example 2)-</p>
  <pre><code>[[[1, 1, 1, 2, 2, 2, 3, 3, 3],
   [1, 1, 1, 2, 2, 2, 3, 3, 3],
   [1, 1, 1, 2, 2, 2, 3, 3, 3], 
  [1, 1, 1, 2, 2, 2, 3, 3, 3]]]
  </code></pre>
  <p>and not-</p>
  <pre><code>[[[1, 2, 3], [1, 2, 3], [1, 2, 3]],
   [[1, 2, 3], [1, 2, 3], [1, 2, 3]],
   [[1, 2, 3], [1, 2, 3], [1, 2, 3]],
   [[1, 2, 3], [1, 2, 3], [1, 2, 3]]]
  </code></pre>