title: using nested lists/nested loops
body: <p>I'm trying to figure out how to use nested lists/nested loops in Python. I'm supposed to write function(s) to create a new table that is comprised of adding the indices of 2 inputted tables in the form of lists. So, for example, if the function was addTables, I would run:</p>
  
  <pre><code>addTables([[1,1],[1,1]],[[2,2],[2,2]])
  </code></pre>
  
  <p>and I would get:</p>
  
  <pre><code>[[3,3],[3,3]]
  </code></pre>
  
  <p>I'm having trouble figuring it out. First, the function I wrote returns 
  [3,3,3,3] when I run my code:</p>
  
  <pre><code>def addElements(element1,element2):
      newlist = []
      for i in range(0,len(element1)):
          for j in range(0,len(element1[i])):
              new_element = element1[i][j] + element2[i][j]
              newlist.append(new_element)
      return newlist
  </code></pre>
  
  <p>Second, we're supposed to use multiple functions. I can't figure out how to split up the program so that different parts are completed by different functions. Could someone point me in the right direction? Any tips would be greatly appreciated.</p>