8. ...and Seek! - why the extra len(board[0])


#1



I noticed in this exercise, under the function random_row(board), instead of return randint(0, len(board) - 1) as in instructed in the previous exercise, the system automatically changes it to return randint(0, len(board[0]) - 1).

This doesn't happen to the function random_row(board)

`


#2

return randint(0, len(board) - 1) calculates the number of rows, randint(0, len(board[0]) - 1) calculates the number of cols. This is particular useful if you have a board in which the rows and cols are not of equal height


#3

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