7/19 Incorrect Row Bounds


#1

This code gives the error message: "It looks like your row bounds are not correct," and I am unsure how to fix it...

from random import randint

board = []

for x in range(0, 5):
board.append(["O"] * 5)

def print_board(board):
for row in board:
print " ".join(row)

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

print print_board


#2

So, close!

For your randint lines you need to start with a return. Without that, you're not writing those randint's out anywhere!


#4

Here's my entire code for reference:

from random import randint 

board = []

for x in range(0, 5):
    board.append(["O"] * 5)

def print_board(board):
    for row in board:
        print " ".join(row)

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