title: break statement for 2d list
body: <p>I am new to Python and have an assignment to extract images and labels from a list. I have a database of images (Red,Green, Blue, Yellow, etc.). The images are in the first column whereas the corresponding labels(Red, Green, Blue, etc are in the second column). I am trying to write a code where let's say I want to run through the loop and extract the first yellow image and break out of the program. The code as it stands right now breaks out of the if loop but goes all the way till the end and updates the i values and the wrong image is extracted. I tried putting multiple break statements as well as break statements in different positions but it doesn't seem to work out for me. Can somebody point me in the right direction?</p>
  
  <pre><code>rows = len(IMAGE_LIST)
  columns = len(IMAGE_LIST)
     for i in range(rows):
        for j in range(columns):
           if IMAGE_LIST[j][1] == "Yellow":
  
           sel_image = IMAGE_LIST[j][0]
  
           sel_label = IMAGE_LIST[j][1]
  
          break
  
   print(j)
  
   plt.imshow(IMAGE_LIST[j][0])
  
   print(IMAGE_LIST[j][1]) 
  </code></pre>