12/19 Could someone explain -1?

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

I don't get this part. It looks like 0 to board's length - 1, but what's this -1 about?
also why is this:


and not print board(board)?


Wow, Same avatar! I thought i posted this question :laughing:


Board type is a list and the length that we have defined in the code is 5, therefore the indexes will be from 0 to 4. So we want to generate random integers between 0 to 4 for depicting the row no. and column no.

The second part it's print_board(board) because we have defined the function by this name.
def print_board(board):
This statement has given that name to the function.


Thank you. I know that it's supposed to go from 0 to 4, but isn't that included in 0 and board length? I'd think that would go from 0 to 4, cause it's the stopping point for its length. Instead we got this weird - 1, which doesn't look like a stopping point or step or anything. Sorry i'm just really stupid :sweat_smile: