How to print each row array? (5. Custom Print)

Instructions: define a function named print_board with a single argument, board.
Inside the function, write a for loop to iterates through each row in board and print it to the screen.

Error: Oops, try again. Your code threw the following error: list indices must be integers, not tuple

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


Try printing step by step and see what happens..

if you still can't manage to solve it call for help again :slight_smile:


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