arrays - Python accesses multiple lists in a nested list. What's going wrong? -


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

Popular posts from this blog

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -