13.5 Custom print


Code has been accepted to pass the lesson, but there's no output on the screen?

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



there are some issues with your print_board() function.

for row in board:
        print print_board

What is print_board here? Did you mean to print row?

return print_board(board)

Here you call the function inside itself. This will lead the function to call itself again and again, once you invoke it. Also I' don't think you need to return anything at all, should be enough to print the board.

If you want output on the screen you need to call the function outside of it's definition, like this:

def hello():
    print "Hello"

#here I call the function


@ajaxpro87806 : Just like @eveat mentioned your function will call itself over and over again until your computer crashes or something like that.

The fact nothing was printed is because you didn't call the function.
If you called it, you'd see the infinite loop, or part of it, and your browser, if using an online IDE, will crash at a certain point.