0

So this is just a snippet of code. But I want to only assign the value to say C[i][j]. However it even assigns the value to C[j][j]

This is the simple code:

n=int(input())
C=n*[n*[0]]
C[0][1]=2
print(C)

The output I get is [[0,2], [0,2]] While the expected output is [[0,2], [0,0]]

khelwood
  • 52,115
  • 13
  • 74
  • 94

0 Answers0