So I created a list within a list and printed it:
a = []
b = []
for i in range(3):
a.append(0)
for i in range(3):
b.append(a)
print(b)
and the result was:
[[0, 0, 0], [0, 0, 0], [0, 0, 0]]
as expected
but when I try assigning the first value of the first list within b with
b[0][0] = 1
print(b)
the result comes out as: [[1, 0, 0], [1, 0, 0], [1, 0, 0]]
How do I assign 1 to only the first value so I get: [[1, 0, 0], [0, 0, 0], [0, 0, 0]]
?