Printing Pretty


#1

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 :
        "".join(board)
        print row 

print board    
Replace this line with your code.


#2

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


#3

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


#4

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