# 5/19

#1

Hey, I managed to pass the level eventually, with the 3rd piece of code in this post. But I'm trying to understand why the first 2 wouldn't work for me.

Based on the fact that it worked once I manually set my loop to run 5 times, I'm guessing it's something to do with my board being larger than just 5 lines of "OOOOO"'s. But I don't understand why that would be the case either.

board = []

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

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

print_board(board)

board = []

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

def print_board(board):
for i in range(len(board)):
print board[i]

print_board(board)

board = []

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

def print_board(board):
for i in range(5):
print board[i]

print_board(board)

#2

Hi
for your first one I just changed the append like so:

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

result will look like this:

['O', 'O', 'O', 'O', 'O']
['O', 'O', 'O', 'O', 'O']
['O', 'O', 'O', 'O', 'O']
['O', 'O', 'O', 'O', 'O']
['O', 'O', 'O', 'O', 'O']
None

#3

Here's what I did

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

def print_board(board):
for i in range(len(board)):
print board[i]

print_board(board)