title: Deleting a desired list in a 2d list
body: <p>Say I have a 2d list like this:</p>
  
  <p><code>list = [[1, 2, 3], ["a", 5, 6], [7, 8, 9], [10, 11, 12]]</code></p>
  
  <p>and I want to delete a list that starts with <code>a</code>. Here is what I tried:</p>
  
  <pre><code>for i in range(0, len(list)):
       if list[i][0] == "a":
            list.pop(i)
  </code></pre>
  
  <p>Here, I am trying to delete a list that starts with <code>a</code>. However, it gives me an error saying </p>
  
  <blockquote>
    <p>IndexError: list index out of range</p>
  </blockquote>
  
  <p>I am not sure what the problem is here. It's weird because when I try <code>print(list[i])</code>, it prints the matching line, which is `["a", 2, 3].</p>
  
  <p>I am expecting <code>list = [[1, 2, 3], [7, 8, 9], [10, 11, 12]]</code> as my final list. </p>