arrays - Python accesses multiple lists in a nested list. What's going wrong? -
this question has answer here:
python doesn't support multidimensional arrays, thought workaround easy enough. it's not working though. here's code
mat = [ [ none ] * 3 ] * 3 mat[0][0] = 1 return mat
output
[[1, none, none], [1, none, none], [1, none, none]]
why changing mat[1][0] , mat[2][0]? if ask print mat[0][0] gives me 1 should.
Comments
Post a Comment