title: deep copy of list in python
body: <p><a href="https://i.stack.imgur.com/JKWre.png" rel="nofollow noreferrer">CODE IN PYCHARM</a></p>
  <p><a href="https://i.stack.imgur.com/JKWre.png" rel="nofollow noreferrer">[1]: https://i.stack.imgur.com/aBP1r.png</a></p>
  <p>I tried to make a deep copy of a list l, but seems like the slicing method doesn't work somehow?I don't want the change in x to be reflected in l.
  So how should I make a deep copy and what is wrong in my code?</p>
  <p>This was my code-</p>
  <pre><code>def processed(matrix,r,i):
      matrix[r].append(i)
      return matrix
  
  l=[[1, 2, 3], [4, 5, 6], [7, 8, 9]]
  x=l[:]
  print(processed(x,0,10))
  print(l)
  </code></pre>
  <p>OUTPUT-</p>
  <pre><code>[[1, 2, 3, 10], [4, 5, 6], [7, 8, 9]]
  [[1, 2, 3, 10], [4, 5, 6], [7, 8, 9]]
  </code></pre>