6/19 did I do It right?


#1

here is my code:

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

Below is what it shows on the monitor:

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
None

It says that I did the lesson right, but I'm not sure. Please help!


#2

The instructions probably describe what should happen, right? Compare instructions with the outcome, and if they don't match, compare the outcome with the code!

There's a button in the post editor for preserving the formatting of preformatted text


#3

I think there should not be comma after print y, and also print is not needed. Remove those and execute the code


#4

I tired the tree ways to go to the next stage
the first is like @samauden said
and the 2nd i modif @bug_boy have , i delete the " print , print y, and for y in z "
but i think the 3rd ways is so good for me and it's same with the example

i just add the " print.join(i) " statement inside the function and for loop
like this:
def print_board(board):
indent preformatted text by 4 spacesfor i in board:
indent preformatted text by 4 spacesindent preformatted text by 4 spacesprint " ".join(i)

print_board(board)

and the output is
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