5/19 Why doesn't this code work?


#1

board = []

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

print ["O"] * 5

def print_board(board):
for x in board


#2

What are you trying to do exacly?

Here is what I think you are attempting.

EXAMPLE:

board = ["O"*5 for x in range(5)]

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

#3

This works for me:

board = []

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

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

print_board(board)


#4

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


#5


#6

did the same code

board = []

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

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

print_board(board)

says back to me
Oops, try again. It looks like you function didn't print out the correct response!


#7

You missed the .append to board