Make a List


#1



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


It prints out way too many 'O's'

Oops, try again. It looks like you do not have 5 rows in your list.


I just want it to print out a row of 5


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


#2

Make your board empty (board=[]). It is because you are going to append the 5 rows onto it. If your board is like what you have now, you have an extra row (that isn't a nested list like the rest).

Keep in mind that you don't really need the ; because this is Python, not Javascript (although having it there will not affect what you're trying to do).


#3

Gotcha mate thanks so much I'll try it out


#4

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