list1=[ [1,2,3,4], [2,3,4,5], [3,4,5,6]]
Here is an example of a list, when I am copying it using .copy() and assigning it to list2, it should create a new list with a new memory location, but when I am changing the list2, list 1 is also changing. Kindly suggest what is wrong with these lines of code
list2=list1.copy()
list2[1][2]=10
print(list2)
→ [[1, 2, 3, 4], [2, 3, 10, 5], [3, 4, 5, 6]]
print(list1)
→ [[1, 2, 3, 4], [2, 3, 10, 5], [3, 4, 5, 6]]