As mentioned by @mcabbott:
To index into a matrix you need to do Matrix[i1,i2], to index into a 3d array you need to do array[i1,i2,i3]
etcetera.
You still can index using only one index, as you point out. This is called linear indexing. But doing Matrix[i1][i2]
is not what you want.
You can take a look at what the docs say about how to index here.
So if you do SQUARE[4][2]
you are going to the 4th element of the array (or equivalently the element [2,2]
). This element is composed of three symbols |,O, and |
. And you are indexing into the second element of this string, which is the character “O”.