def random_row(board):

return randint(0, len(board) - 1)

def random_col(board):

return randint(0, len(board) - 1)

why do we -1 from the length of the board when defining the random column and row functions

def random_row(board):

return randint(0, len(board) - 1)

def random_col(board):

return randint(0, len(board) - 1)

why do we -1 from the length of the board when defining the random column and row functions

because lists are zero indexed based? The list has 5 indexes: 0, 1, 2, 3, 4. so the length is 5. But you don't want 5, given the last index is 4, so that is why you do minus one