title: Defining a new list so that modifications do not affect the original without importing copy
body: <p>I know that there have been several similar discussions on this topic and I have tried to implement at least one (a list comprehension). The main issue is that my original list (it is actually a matrix set up as a list of lists) is being modified by part of my code, but I can not seem to figure out why.</p>
  <p>Here is the code that I have</p>
  <pre><code>def eliminate_row_column(mat,k,l):
      new_matrix = [i for i in mat]      #creates a new temp matrix
      new_matrix.pop(k)        #eliminates the kth row
      for i in range(len(new_matrix)):
          new_matrix[i].pop(l)     #eliminates the lth column
      return new_matrix
  </code></pre>
  <p>It appears to be removing the kth element (the kth row) without modifying the original. However, when I enter the for loop it appears to be modifying the original input list.</p>
  <p>It appears that using a deep copy might resolve the issue, but I will need this code to work in context where (students) can not import in.</p>
  <p>I am not a programmer by training and this one is giving me a bit of a headache.
  Any help would be appreciated.</p>