I am studying Python and in the below list called 'picture', I want an output of 0's replaced by space and 1's replace by '*'
picture = [
  [0,0,0,1,0,0,0],
  [0,0,1,1,1,0,0],
  [0,1,1,1,1,1,0],
  [1,1,1,1,1,1,1],
  [0,0,0,1,0,0,0],
  [0,0,0,1,0,0,0]
]
picture_new = picture[:]
###1st answer, trying to practice list
for test in picture:
  for x,y in enumerate(test):
    if y == 0:
      test.pop(x)
      test.insert(x, " ")
    else:
      test.pop(x)
      test.insert(x, "*")
  print("".join(test))
print()
###########################
###2nd answer simplified
for row in picture_new:
  for col in row:
    if(col == 0):
      print(" ", end="")
    else:
      print("*", end="")
  print("")
#why the new picture list is affected by 1st answer...
print(picture)
Both answers, when run individually, give me the exact output that I want which is
   *   
  ***  
 ***** 
*******
   *   
   *
But when I run the whole program, I got the below output. I am wondering why the 2nd list is affected by what I have done with the 1st answer.
   *   
  ***  
 ***** 
*******
   *   
   *   
*******
*******
*******
*******
*******
*******
Please help me in understanding why it seems I am manipulating a single list even though I used two different lists and different variables for for loops.
Thanks and have a great day!
