Exercise 3/10, gives error even though it works!


#1

Hey I am on Exercise 3/10 for the Battleship course of Python and it tells me this, "Create a 5 x 5 grid initialized to all 'O's and store it in board.". Well I made this code to follow the directions given to me to make a 5x5 grid of O's.

board = []
for item in range(5):
    print (['O'] * 5)

And the result I got was this:

['O', 'O', 'O', 'O', 'O']
['O', 'O', 'O', 'O', 'O']
['O', 'O', 'O', 'O', 'O']
['O', 'O', 'O', 'O', 'O']
['O', 'O', 'O', 'O', 'O']

But for some reason it gives this error: " It looks like you do not have 5 rows in your list.". Any help?


#2

Check the content of your board.

print board

#3

I just figured out the problem, I guess I was going too fast for the course. It wanted this code:
board = []
for item in range(5):
board.append(['O'] * 5)