3
votes

Help! end='' is causing a syntax error and I'm not sure why.

def print_game_board(game_board_marker):
    for i in range(len(game_board_marker)):
        for j in range(len(game_board_marker[i])):
            print(str(game_board_marker[i][j]).rjust(4), end='')
        print()
    print()
1

1 Answers

2
votes

It seems like you're using Python 2.x, not 3.x.

Check your python version:

$ python -V

Python 2.7:

>>> print(1, end='')
  File "<stdin>", line 1
    print(1, end='')
                ^
SyntaxError: invalid syntax

Python 3.3:

>>> print(1, end='')
1>>>