6. Printing pretty


#1



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


The goal of the exercises is to make the rows as "O O O O O" which my code does but it still says its not the right response.
Where am i going wrong? Thank you! :slight_smile:


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

def print_board(board):
    for i in board:
        print '"'+" ".join(i)+'"'

print_board(board)


#2

Invalid assignment. We cannot assign a statement to a variable. board.append(x) is a statement.

The yield of join is always a string so we do not need to provide a quote wrapper. I bet you are relieved to learn that?

print ' '.join(i)

#3

oh, so i should leave the statement on its own then?
about the quotes, i did that because without them, it was just printing a series of Os and i was getting an error. so, i thought that it was because it was missing quotes.
Thank you!


#4

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