Printing Pretty(Why isnt it working?)


#1



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

Oops, try again. It looks like you function didn't print out the correct response!


What is wrong?


board = []

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

print board


#2

Hi @ebiwonjumio ,

You have this ...

print "".join(row)

... but the instructions ask for the following output format, which has a space between each "O" character ...

"O O O O O"

Call the join method from " " instead of from "".

You also have this statement ...

print board

Why not call your print_board function instead?


#3

Thank you! I actually figured out already!


#4

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