Printing Pretty


Why does my code work with "".join(board) instead of "".join(row).

board = []
for n in range(5):
    board.append(['O'] * 5) 

def print_board(board):
    for row in board :
        print row 

print board    
Replace this line with your code.


In fact it didn't even "print pretty".... it only prints "pretty" when I add
print print_board(board)
to the ending print statement


because row contains each row of your board? Which you want to print nicely

function only execute when called, so yes, to print the board pretty, you need to call print_board


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