title: Why doesn't the pop method break the while-loop in this example?
body: <p>Expected Outcome: while loop will break when z = []</p>
  <p>Actual Outcome: Index Error. Loop does not break even after pop method &quot;empties&quot; the list.</p>
  <p>Index error at &quot;front_of_list = z[0]&quot; because at that point, z = []</p>
  <p>Example code:</p>
  <pre><code>z = [6,3,7,4,9,7,8,4,5,7]
  while z:
      front_of_list = z[0]
      if z[0] == 7:
          print(&quot;SEVEN!&quot;)
          popped = z.pop(0)
      front_of_list = z[0]
      print(front_of_list)
      popped = z.pop(0)
  </code></pre>