Make a List


#1


board = []
for i in range(0,5):
    board.append(["0"]*5)
def print_board(board):
    for i in board:
        print " ".join(i)
    
    
print print_board(board)   

what is wrong with my code?
it says :-Oops, try again. It looks like your board contains characters other than "O".


#2

hey,
board = []
for i in range(5):
board.append(["O"]*5)
print board

try this , you dont need to use to join method yet...


#3

alpha102,

Here is a copy of what I've managed to get running locally.

board = []

for i in range(0,5):
* board.append(["O"]5)**

##print(board)

def print_board(board):
** for row in board:**
** print(' '.join(row))**

print_board(board)

the difference, from what I can tell is that the code above doesn't try to print the function when it's called. The function already has the print command.


#4

you have used Zero instead of capital 'O'


#5

I made this way and it worked:

board = []
for i in range(0,5):
board.append(["O"]*5)


#6

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