title: Custom traceback function for matrix not working
body: <p>I am trying to implement the Nussinov algorithm for RNA folding in Python 3.</p>
  
  <p>So far, I have my correct matrix and I am trying to <code>traceback</code> through this matrix.</p>
  
  <p>Essentially, the function should start at the top right cell of a matrix and proceed through the cells according to the algorithm, until it reaches the diagonal.</p>
  
  <p>The problem is nothing happens to change the <code>structure</code> list.
  Can anyone tell me why?</p>
  
  <pre><code>structure = list()
  
  for base in seq:
      structure.append('.')
  
  def traceback(i, j, matrix1):
      if j - i &gt; 0:
         return
  
      elif matrix1[i][j] == matrix1[i+1][j]: # if value same as cell under i,j
          traceback(i+1, j, matrix1)
  
      elif matrix1[i][j] == matrix1[i][j-1]: # if value same as cell on left of i,j
          traceback(i, j-1, matrix1)
  
      elif matrix1[i][j] == (matrix1[i+1][j-1] + 1):
          traceback(i+1, j-1, matrix1)
          structure[i] = '('
          structure[j] = ')'
  
  print(matrix1)
  traceback(0, n-1, matrix1)
  </code></pre>