title: python how to change element in nested list
body: <p>I have been using python for a lot and today I get surprised by a simple nested list. </p>
  
  <p>How can I change the value of an element of my list?</p>
  
  <pre><code>&gt;&gt;&gt; l=[[0,0]]*10
  &gt;&gt;&gt; l
  [[0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0]]
  &gt;&gt;&gt; l[0]
  [0, 0]
  &gt;&gt;&gt; l[0][0]
  0
  &gt;&gt;&gt; l[0][0]=1 #here comes the question
  &gt;&gt;&gt; l
  [[1, 0], [1, 0], [1, 0], [1, 0], [1, 0], [1, 0], [1, 0], [1, 0], [1, 0], [1, 0]]
  &gt;&gt;&gt; 
  </code></pre>
  
  <p>I would expect as final result </p>
  
  <pre><code>l=[[1,0],[0,0],[0,0]...]
  </code></pre>
  
  <p>Why it does not append? (I would like a theoretical explanation )
  How can I get the desired result?</p>
  
  <p>Thanks.</p>
  
  <p>EDIT: 
  In starting the list in another way I get the desired result</p>
  
  <pre><code>&gt;&gt; l=[[0,0],[0,0]]
  &gt;&gt;&gt; l
  [[0, 0], [0, 0]]
  &gt;&gt;&gt; l[0][0]=1
  &gt;&gt;&gt; l
  [[1, 0], [0, 0]]
  &gt;&gt;&gt; 
  </code></pre>
  
  <p>but I am still wondering why the first version does not work and how can I initialize a  list of a lot of elements?</p>