6. Printing Pretty


#1

I can’t figure out why it is saying my answer didn’t print out correctly?


#2

the board should look like this:

0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0

your board is missing a few spaces (to make it look a bit cleaner)


#3

Ah, I realized that I needed to add a space in line 7. Thanks!


#4

The parameter in the print_board function header is board_in. Therefore, you should also be using board_in within this for loop header instead of using board

    for row in board

The correction will not change the output in this case, but in general, a function should access its parameters rather than access global variables directly, when the intent is to pass the global variable to the function as an argument, as is done here …

print_board(board)

Subsequent to that function call, board_in refers to the global board object as the function executes. So, use the board_in variable within the function.


#5

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