data-structures Matrices Intro to matrices


Matrices are essentially two-dimensional arrays.

That means that it associates (i, j) coordinates, where i is the row and j is the column, to a value.

So, you could have :

m3, 4 = "Hello"

The easiest implementation is to make an array or arrays. In python, that would go as follows.

matrix = [["a", "b", "c"], ["d", "e", "f"], ["g", "h", "i"]]
print(matrix[1][2]) #returns "f"