Hide...: Not printing result?



Does not print grid when complete

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)

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


You need to call the print_board() function after you've written it. At the end of the code, or wherever you want it printed (after it's been defined), type: print_board(board)


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