Print board[2][3]


What does

print board[2][3]

mean. What does [2] and [3] mean respectively.


they are index numbers of the list you are accessing


So for


it refers to index 2 of board and index 3 of board. I thought it was the row number and column number of the board in

Danger, Will Robinson!!


You can imagine it as a 2D matrix (in this case; N square brackets N dimensional matrix). First square brackets are rows in the matrix, second brackets are columns.


If it is the row number and column number, why does


refer to the 3rd row and 4th column.


because first index is always 0


no, you have a multi dimensional array:

board = [[1,2,3],[4,5,6][7,8,9]]

so board[1][1] would be 5, counting starts from zero, so 1 is array 4,5,6, then the second one is the second item in that array (5)

Because counting starts from zero


Oh, thank you. It's indexing the outer list and indexing a inner list to get a certain item within the two lists. Now it makes sense. Thank you. Also, what is a multi dimensional array?


arrays are called list in pythons, can be confusing working multiply languages. In that case they are nested lists (list nested inside a list)


Thank you very much.