x = [[7, 8], 3, "hello", [6, 8], "world", 17] # List 1
w = list.copy(x) # copying list 1 to list 2
w[0][1] = 5 # changing the value in list 2
print(w)
print(x)
Output:
[[7, 5], 3, 'hello', [6, 8], 'world', 17]
[[7, 5], 3, 'hello', [6, 8], 'world', 17]
Changes to w
are affecting x
too.