Don't Sink My Battleship! | 3. Make a List HELP!


#1

HELP, I don't know how my code is not working:

board = []
for i in range(0, 5):
board.append("O")
for i in range(0, 5):
print board

Prints:
['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']
None

Error: "Oops, try again. It looks like the rows are not represented as lists."


#2
board =  []

for n in range(5):
board.append(['O'] * 5)

This is the correct code, I think that the error that you are running into is that all of the lists must be contained in a list as well. Your code will print 5 separate lists, which is much harder to manage.