Home>
def drawBoard(board): # Draw the board data structure.
  tensDigitsLine= ' ' #Create space for numbers down the left side of the field.
  for i in range(1,6):
     tensDigitsLine += (' ' * 9) + str(i)
  #Display the numbers at the top of the field.
  print(tensDigitsLine)
  print(' '+('0123456789' * 6))
  print()
  #Display each of the 15 rows
  for row in range(15):
    if row< 10:
        extraSpace= ' '
    else:
        extraSpace= ''
    boardRow= ' '
    for column in range(60):
        boardRow += board[column][row]

Do you understand the meaning of this error and why it occurs in your code?

MaxU2022-02-02 15:23:01
  • Answer # 1

    I don't know what kind of data you are passing to this function and what dimensions they are, but in this line you have one of the indexes that goes beyond the bounds of the arrayboardRow += board[column][row], orcolumn, orrow, try to remove first one, then the other, and see which error occurs.

  • Answer # 2

    I don't know what kind of data you are passing to this function and what dimensions they are, but in this line you have one of the indexes that goes beyond the bounds of the arrayboardRow += board[column][row], orcolumn, orrow, try to remove first one, then the other, and see which error occurs.