0

This is probably very basic, but I am having trouble navigating nested lists in python 3.

list1 = [[0]*3]*3
list1[0][1] = 1
print(list1)

Produces the output

[[0, 1, 0], [0, 1, 0], [0, 1, 0]]

when I expected the output to be

[[0, 1, 0], [0, 0, 0], [0, 0, 0]]

Why is this happening?

kriops
  • 1

0 Answers0