title: Python: copying a list within a list
body: <p>Hoping someone can help me here.</p>
  
  <p>I'm very new to Python, and I'm trying to work out what I'm doing wrong.</p>
  
  <p>I've already searched and found out that that Python variables can be linked so that changing one changes the other, and I have done numerous tests with the <code>id()</code> function to get to grips with this concept.  But I seem to have found an exception I'm hoping someone can explain...</p>
  
  <p>firstly, the following works as expected to make a independent copy of a list.</p>
  
  <pre><code>&gt;&gt;&gt; a = [0,0]
  &gt;&gt;&gt; b = a[:]
  &gt;&gt;&gt; print a is b
  False
  &gt;&gt;&gt; b[0]=1
  &gt;&gt;&gt; print a
  [0,0]
  &gt;&gt;&gt; print b
  [1,0]
  </code></pre>
  
  <p>But if I change this slightly so that <code>a</code> is list within a list it changes...</p>
  
  <pre><code>&gt;&gt;&gt; a = [[0,0],[0,0]]
  &gt;&gt;&gt; b = a[:]
  &gt;&gt;&gt; print a is b
  False
  &gt;&gt;&gt; b[0][0]=1
  &gt;&gt;&gt; print a
  [[1, 0], [0, 0]]
  &gt;&gt;&gt; print b
  [[1, 0], [0, 0]]
  </code></pre>
  
  <p>Now we see that any update of <code>b</code> will also apply to <code>a</code>, but yet the result of <code>print a is b</code> returns <code>False</code>??  I've check this against <code>id()</code> as well, everything says they are independent of each other, but when I update one the same applies to the other??</p>
  
  <p>Can anyone explain this??</p>
  
  <p>Noting I'm running these of <a href="http://labs.codecademy.com/#:workspace" rel="noreferrer">http://labs.codecademy.com/#:workspace</a>, so my first thought is that it's just a bug on their site, but I don't know?</p>
  
  <p>EDIT:</p>
  
  <p>THANK YOU ALL for the great answers so far.  That was fast!  I know this has probably been asked before but it was difficult thing to search for.</p>
  
  <p>Since all the answers are correct, I'll wait a day before marking.  whoever has the most +1's will get the mark :)</p>