title: Can I use .pop() and .append() on the same item at the same time in Python?
body: <p>So I have two lists and I want to use .pop() to remove an item from ListA and then use .append() to add it to ListB. I've tried this, but as soon as I use .pop(), the .append() function takes one index after that.</p>
  
  <p>Here is the code I have so far:</p>
  
  <pre><code>ListA = ['a', 'b', 'c', 'd', 'e']
  ListB = []
  
  ListA.pop()
  ListA.pop()
  ListA.pop()
  
  print 'ListA =', ListA
  print 'ListB =', ListB
  </code></pre>
  
  <p>The output I get is:</p>
  
  <pre><code>ListA = ['a', 'b']
  ListB = []
  </code></pre>
  
  <p>I would like the output to look like this:</p>
  
  <pre><code>ListA = ['a', 'b']
  ListB = ['e', 'd', 'c']
  </code></pre>
  
  <p>I know I don't have any .append() functions, but when I put them in there I get an error. So that's the code working with just the .pop() function. I want to take the item that is being removed with .pop() and then append it to ListB.</p>
  
  <p>Thanks for your help.</p>