Custom print


#1
board=[]
for i in range(5):
  board.append(5 * ["O"])
  def print_board(board_in):
    for row in board_in:
      print
return print_board(board)

error:
File “python”, line 6
return print_board(board)
^
IndentationError: expected an indented block

help plz


#2

board = []

range(5) is a shortcut for range(0, 5)

for i in range(5):
board.append(5 * [“O”]) # this appends a list of five “O” strings
for z in board:
for y in z:
print y,
print # blank line

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


#3

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