6. Printing pretty - didn't print out the correct response!


#1

Can someone tell me where I am going wrong please? I am getting the error

"Oops, try again. It looks like you function didn't print out the correct response!"

board = []

def battleship(grid):
    for i in range(5):
        board.append(5 * ["O"])
    return board

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

print_board(board)

Thanks in advance!


#2

why do you have a battleship function (line 3)? its nowhere in the instructions

you never call the battleship function, so the function never executes, so the board is never created. Without the board existing properly, you can't print it pretty


#3

Ah thank you so much for this!!

Not sure where battleship came from in all honesty...


#4

i mean, its possible, bit more challenging if you like, but if you are already struggling i would advice against it, good luck! Any questions left for me?


#5

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