title: Reassigning variables in python
body: <p>I have the following code and variables, and I want to find what the variables <code>a</code>, <code>a1</code>, <code>a2</code>, <code>b</code>, <code>b1</code>, and <code>b2</code> refer to after the code has been executed.</p>
  
  <pre><code>def do_something(a, b):
      a.insert(0, "z")
      b = ["z"] + b
  
  a = ["a", "b", "c"]
  a1 = a
  a2 = a[:]
  b = ["a", "b", "c"]
  b1 = b
  b2 = b[:]
  
  do_something(a, b)
  </code></pre>
  
  <p>My attempted solution is as follows:</p>
  
  <pre><code>a = ["z", "a", "b", "c"]
  a1 = ["a", "b", "c"]
  a2 = ["a", "b", "c"]
  b = ["z" "a", "b", "c"]
  b1 = ["a", "b", "c"]
  b2 = ["a", "b", "c"]
  </code></pre>
  
  <p>But the actual solution is:</p>
  
  <pre><code>a = ["z", "a", "b", "c"]
  a1 = ["z", "a", "b", "c"]
  a2 = ["a", "b", "c"]
  b = ["a", "b", "c"]
  b1 = ["a", "b", "c"]
  b2 = ["a", "b", "c"]
  </code></pre>
  
  <p>Can anyone walk me through my mistake?</p>