3. Make a list , Please Help!


I am not sure why but i'm getting this error" It looks like the rows are not represented as lists" its printing 5 rows of O like this:

Here is my code:

board = []
n = "O" * 5
for x in range (0,5):
    print n


The error says to re-code to have your output as 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'], ['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']]
[['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']]

Hope this helps! :smile:


I would suggest putting the variable inside the loop, because we want to do it a total of 5 by 5.
my code for your review:
board = []
for x in range ( 0, 5 ) :
Lst = ["O"] * 5
print lst
board.append ( Lst )

hope that would be helpful:smile:


I had this same problem / confusion. It turns out the lesson just wants you to do it differently so you can later show misses on the board. With your current setup, while it looks as it should, you cannot add misses to it easily.


Okay, I feel @netwhiz48045 gave so much for the help question asked. However, where @phrygianballad had a little issue could be corrected to be this:

board = []
for i in range(5):
    print board

Hope this helps! :wink: