What is going on 7 Hide


#1
def random_row(board):
    ship_row = randint(0,len(board)-1)
def random_col(board):
    ship_col = randint(0,len(board) -1)
random_row(board)
random_col(board)

#2

you should re-read the instructions:

Define two new functions, random_row and random_col, that each take board as input.

These functions should return a random row index and a random column index from your board, respectively. Use randint(0, len(board) - 1).

Call each function on board.

def random_row(board): <---- defined with board as input
    return randint(0, len(board) -1) <---- returns a random position on the board and makes sure its acual on the board
random_row(board) <---- calls the function(its here for organization purposes(after the function its calling))

def random_col(board): <---- defined with board as input
    return randint(0, len(board) -1)
random_col(board) <---- calls the function(its here for organization purposes(after the function its calling))

#3

All that is really needed to get past this one is to add "return" before the randint and you'll be good. You can get rid of your bottom two lines of code (than random row and column).

# Add your code below!
def random_row(board):
    return randint(0,len(board) - 1)

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