title: Diagonal in matrix - python
body: <p>I need to write a function that will return the sum of numbers that form a diagonal in any given matrix. <br> Being a Python newbie I've got a problem. This is my code:</p>
  
  <pre><code>def diagonal(matrix):
      return sum([matrix[i][i] for i in range(len(matrix))])
  </code></pre>
  
  <p>I've been trying for some time now but don't see what is wrong because it always gives me back report about error saying "list index out of range". </p>
  
  <p>I am <strong>not</strong> allowed to import <code>numpy</code>.</p>
  
  <p>Any form of help, hint, advice would be appreciated.</p>