Battleship! keep getting error messages


#1


https://www.codecademy.com/courses/python-beginner-en-4XuFm/0/5?curriculum_id=4f89dab3d788890003000096#

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


board = []
for i in range(0,5):
    the_list = ["O"] * 5
    board.append(the_list)
def print_board(board):
    for row in board:
        print "".join(row)
        
print_board(board)


#2

you need a space between the O's in each row


#3

How do I get that done?


#4

look into how join is used


#5

After making sure there is space between the "Os", I am still getting error messages

Error Message: Oops, try again. It looks like you function didn't print out the correct response

Code:

board = []
for i in range(0,5):
    the_list = ["O"]*5
    board.append(the_list)
def print_board(board):
    for row in board:
        print "  ".join(row)
        
print_board(board)

#6

now you have two spaces, one is enough


#7

I have reduced it to one space, and still the same error. You can please try running the code:

https://www.codecademy.com/courses/python-beginner-en-4XuFm/0/5?curriculum_id=4f89dab3d788890003000096

board = []
for i in range(5):
    the_list = ["O"]*5
    board.append(the_list)
def print_board(board):
    for row in board:
        print " ".join(row)
        
print_board(board)

#8

you are not even at the exercise where you should use join?


#9

A post was split to a new topic: Battleship, printing


#10

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