title: List changes automatically in python
body: <p>The below code is changing the value of the list K automatically, please help me know why</p>
  
  <pre><code>1
  4
  1 2 4 3
  </code></pre>
  
  <p>I gave the above input</p>
  
  <p>The output is this</p>
  
  <pre><code>[1, 2, 3, 4]
  [1, 2, 3, 4] 1
  [1, 2, 3, 4] 2
  1 1
  [1, 2, 3, 4] 2
  2 2
  [1, 2, 3, 4] 2
  3 4
  [1, 2, 3, 4] 2
  4 3
  [1, 2, 4, 3]
  [1, 2, 4, 3] 1
  [1, 2, 4, 3] 2
  1 1
  [1, 2, 4, 3] 2
  2 2
  [1, 2, 4, 3] 2
  4 4
  [1, 2, 4, 4] 2
  4 3
  [1, 2, 4, 4]
  [1, 2, 4, 4]
  </code></pre>
  
  <p>In the last steps the value of list k changed automatically.</p>
  
  <p>This was done on PyPy 3 and python 3.7</p>
  
  <pre><code>t=int(input())
  while t!=0:
      t-=1
      n=int(input())
      h=[0]*n
      lt=[0]*n
      c=0
      l=[int(i) for i in input().split()]
      k=[i for i in range(1,n+1)]
      print(k)
      while c!=7:
          print(k, end=" ")
          print("1")
          c+=1
          for i in range(n):
              print(k, end=" ")
              print("2")
              lt[l[i]-1]=k[i]
              print(k[i],end =" ")
              print(l[i])
          k=lt
          print(k)
          for i in range(n):
              if k[i]==l[i] and h[k[i]-1]==0:
                  h[k[i]-1]=c
      print(*h,sep=" ")
  </code></pre>