Matrices in Python


I am wondering why we are using a list of 5 lists to make this board and not a 5x5 matrix.

I haven't seen matrices mentioned yet while learning Python. Are they used outside of their mathematical context?

for i in range(0,5):


Within Python itself we can only use list of lists. However there is a module, NumPy. There was some interest in matrice math years ago, but all the members have long ago moved on.

If you have some interest, start a topic in the Corner Bar, using this course as a model. However, consider also that this program does not perform any math, only look-ups, and the data is string, not numeric which may explain why the author chose to go the way he did.


So am I still able to access information as a row or column? For example lets say we set up the lists like this : [O,O,O,O,O],[X,X,X,X,X,],[O,O,O,O,O].

Is it possible for me to access just a column here (which would look like [O,X,O])?


Because of the linearity of a list, we cannot access the column (as a whole) directly, but must iterate through the rows.

col = []
x = 3
for row in rows:


Ok, got it. Thanks for the help!