7 & 8: Hide ... and Seek!


I am not understanding… are these the same?

def random_row(board_in):
return randint(0, len(board_in) - 1)

def random_col(board_in):
return randint(0, len(board_in) - 1)

def random_row(board):
return randint(0, len(board) - 1)

def random_col(board):
return randint(0, len(board[0]) - 1)

I know random_row is the same but why does random_col have board[0]. Is it the same as the code in 7? If so, why? If not, why?

Thank you


For a square board, the two could both use the random_row() function. The idea of a distinct random_col() function is to facillate rectangular boards that are not square.


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.