title: Comparing rows of 2D list of unequal size with try catch causes program to jump around erratically
body: <p>I have a 2D list called Matrix. Each column can have an unequal number of rows. I need to compare the rows. If a row doesnt exist for a column then my try catch skips it and leaves the variable the row is set to as an empty string.</p>
  
  <p>The problem is that the code will jump around to different exception blocks when an index doesn't exist. For example, if z is out of range then the code might jump to the exception rule immediately after y and execute z again. Sometimes this loop exits with values of K like 5 when it should never go past 3.</p>
  
  <p>How can i stop the code from jumping around like this and proceed to the exception rule immediately after try. Is there a better way to compare the rows of a 2D list with different numbers of rows without erratic try catch behavior?</p>
  
  <pre><code>while(k &lt; 3):
   x = ""
   y = ""
   z = ""
   k = 0
   try:
       x = Matrix[0][i]
   except IndexError:
       k = k + 1
  
   try:
       y = Matrix[1][i]
   except IndexError:
       k = k + 1
  
   try:
       z = Matrix[2][i]
   except IndexError:
       k = k + 1
  
   if k == 3:  #Prevents submitting x,y,z if they are all empty strings
       break
   i = i + 1
   results = compare(x,y,z)
  </code></pre>