I have the following code.
x = [['']*2]*2 # [['', ''], ['', '']]
x[0][0] = 'a'
This produces the following. But why? When I actually just changed the first element of the first list.
[['a', ''], ['a', '']]
Or is [['']*cols]*rows
not the right way to create a matrix in Python?