title: List of all diagonals in a matrix without using numpy - Python 3
body: <p>Let's say I got the following matrix:</p>
  
  <pre><code>[[5,4,3,2], [8,7,6,5], [4,3,2,0]]
  </code></pre>
  
  <p>I want to create 2 seperate functions that create a list of all diagonals from right to left, and from left to right without using the numpy module!</p>
  
  <p>for e.x:</p>
  
  <pre><code>[[4], [8,3], [5,7,2], [4,6,0], [3,5], [2]]   # these are the right to left diagonals
  </code></pre>
  
  <p>I tried several different ways but with no success. also, I scanned stack overflow pretty massivly for answers, but did't find any that don't contain numpy.</p>
  
  <p>edit: here is a code that I wrote that is supposed to handle some of the diagonals:</p>
  
  <pre><code>L = [[5, 4, 3, 2], [8, 7, 6, 5], [4, 3, 2, 0]]
  
  
  def search_diagonally_rtl(matrix):
      num_of_rows = len(matrix)
      num_of_cols = len(matrix[0])
      diag_mat = list()
      for i in range(0, num_of_rows):
          diag_mat.append([matrix[i][0]])
      row_index = 0
      for row in diag_mat:
          for k in range(0, row_index):
              i = k
              j = 1
              while i &gt;= 0:
                  row.append(matrix[i][j])
                  i = i - 1
                  j = j + 1
          row_index += 1
  </code></pre>
  
  <p>the output is: <code>[[5], [8, 4], [4, 4, 7, 3]]</code></p>
  
  <p>but should be : <code>[[5], [8, 4], [4, 7, 3]]</code></p>