Checking the upper triangle matrix elements in python
<p>I have an upper triangle matrix, with many empty elements, however, I want to check which indices have empty elements but I want to check only those on upper, cause it's normal that the lower ones will be empty, so I don't want to check those. So I want to check the elements shown in the picture if they are empty or not, covering all the cases no matter what the size of n is:<a href="http://i.stack.imgur.com/D1WpY.png" rel="nofollow"><img src="http://i.stack.imgur.com/D1WpY.png" alt="enter image description here"></a></p>

<p>Here is my trial, but it's not covering everything and it's also making repetition, what I'm doing wrong?</p>

<pre><code>for i in range(len(m)):
    for j in range(len(m)):
  words_length = len(words)

                if (m[i][j] == '' and i == j) or (m[i][j] == '' and i== j-3):

                           print ("["),
                           print (i+1),
                           print (","),
                           print (j+1),
                           print ("]"),
                           print(":"),
                           print("-")
                for s in range(0,words_length-1):

                          if ((m[i][j] == '' and i== s and  j == i+1 )  or (m[i][j] == '' and i== 0  and  j== words_length-1)):

                           print ("["),
                           print (i+1),
                           print (","),
                           print (j+1),
                           print ("]"),
                           print(":"),
                           print("-")

                for r in range(0,words_length-3):

                          if (m[i][j] == '' and i==r and  j== i+2 ):
                           print ("chart"),
                           print ("["),
                           print (i+1),
                           print (","),
                           print (j+1),
                           print ("]"),
                           print(":"),
                           print("-")
</code></pre>

<p>I think i got it, by simply adding when <code>j&gt; i</code></p>

python matrix