7/19 help


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

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

Why there is a "[0]' in fourth line?


#2

Each element in the list board represents a row, and in each row there is one element for each column.
So the number of columns can be found by looking at how many elements there are in a row.


#3

https://www.codecademy.com/forum_questions/50a3cc912010f99cc7005625

Found answer here! Thanks.


#4


#5

You won't be able to change the board size


#6

This is the one that works if anyone needs it...
def random_row(board):
ship_row = randint(0,len(board) - 1)
return ship_row
def random_col(board):
ship_col = randint(0, len(board) - 1)
return ship_col

I didn't at 0,4 and also there is no need for random