Custom Print. Please Explain


#1
board = []
 
for i in range(5):
     board.append(["O"] * 5)
     
def print_board(board):
    for x in board :
       print x
            
print print_board(board)

Please could someone explain this piece of code to me .
Any help is greatly appreciated.
Thanks!


#2

Is there something specific that you're wondering about that code?


#3
def print_board(board):
    for x in board :
       print x

This part prints out the board row by row.

print print_board(board)

This works, but you should just use:

print_board(board)

The difference is, that print print_board(board) prints the return value of print_board(), which is None. Calling print_board(board) as a side effect prints out the board.


#4

Got that ! Thank you very much