title: Changing list elements in shallow copy
body: <p>I have one question about list shallow copy.</p>
  
  <p>In both examples, I modified one element of the list, but in example 1, list <code>b</code> changed, while in example 2, list <code>d</code> is not changed. I am confused since in both examples, I modified an element of the list. </p>
  
  <p>What's the difference?</p>
  
  <p>Example 1:</p>
  
  <pre><code>a=[1,2,[3,5],4]
  b=list(a)
  a[1]=0
  print(a)   # [1, 0, [3, 5], 4]
  print(b)   # [1, 2, [3, 5], 4]
  </code></pre>
  
  <p>Example 2:</p>
  
  <pre><code>c=[1,2,[3,5],4]
  d=list(c)
  c[2][0]=0
  print(c)   # [1, 2, [0, 5], 4]
  print(d)   # [1, 2, [0, 5], 4]
  </code></pre>