I tried to make a 2D array using list in python in this method:
N = 3
A = [[0]*N]*N
for i in range(N):
for j in range(N):
A[i][j] = (i*N + j+1)
print (A)
The output was:
[[7, 8, 9], [7, 8, 9], [7, 8, 9]]
i wanted output like this:
[[1, 2, 3], [4, 5, 6], [7, 8, 9]]
Can someone please tell me what is wrong in this code?