def main():
row = 5
col = 3
count = 0
board = list([[""]*col]*row)
for i in range(0,row):
for n in range(0,col):
board[i][n] = str(count)
print board[i][n] , count, i, n
count+=1
print board
main()
When I run this code, I expect my list to be :
[[0,1,2],[3,4,5],[6,7,8],[9,10,11],[12,13,14]]
and when I print the individual indices inside the loop, it assigns properly but after exiting the loop, I fine the output ends up being
[[12,13,14],[12,13,14],[12,13,14],[12,13,14],[12,13,14]]