Printing Pretty


#1

I don’t understand what I have missed in my code.
[‘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’]
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

ERROR is - It looks like you function didn’t print out the correct response!



board = []

for x in range(5):
  board.append(["O"] * 5) 
  
def print_board(board_in):
  for row in board:
    print " ".join(row)
    print row
    
print print_board(board) 


Thanks in advance.


#2

-1 Your function call
like
print print_board(board)
would be used if your print_board() function would use the return statement…
so use
print_board(board)

-2 Have you tried using

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

def print_board(board_in):
  for row in board:
    print " ".join(row)
    #print row

#3

@leonhard.wettengmx.n
Thank you so much :slight_smile:


#4

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