I am trying to resolve the error as highlighted in the picture below. I am able to print a tic-tac-toe board but the trailing whitespace affects the test case. I am not better yet at using strings to represent a list of numbers. The desired output is embedded in the image below:

def printBoard(plane):#function to print out the current board
for w in range(len(plane)):
for e in range(len(plane)):
if plane[w][e]== 1:
print('{:^3}'.format('X'), end="")
elif plane[w][e] == -1:
print('{:^3}'.format('O'), end="")
elif plane[w][e] == 0:
print('{:^3d}'.format((len(plane)*w+e)), end="")
print()
This will do want you want. Changed
endto vary if it was the end of a line and used periods(.) to make the spaces visible for demonstration. Refactored a bit to remove redundant code:Output: