[Tutor] UNSUBSCRIPTABLE?
Brett Wilkins
lupin at orcon.net.nz
Mon Mar 9 02:25:36 CET 2009
Your problem:
def main():
DisplayInstruct()
puter, human = Pieces()
turn = X
board = NewBoard <<<------This line
DisplayBoard(board)
if you read my email before, I described this to you :) put brackets on
the end of NewBoard (so NewBoard() ) and this should work.
Cheers
WM. wrote:
> I am using Python 26 on a Windows XP
>
> OK, here are the three lines mentioned following the error message.
>
> Traceback (most recent call last):
> File "C:\Python26\TicTacToeD.py", line 165, in <module>
> main()
> File "C:\Python26\TicTacToeD.py", line 150, in main
> DisplayBoard(board)
> File "C:\Python26\TicTacToeD.py", line 68, in DisplayBoard
> print "\n\t", board[1], "|", board[2], "|", board[3]
> TypeError: 'function' object is unsubscriptable
>
>
> line 165 = main()
>
> def main():
> DisplayInstruct()
> puter, human = Pieces()
> turn = X
> board = NewBoard
> DisplayBoard(board)
>
> line 150 = DisplayBoard(board)
>
> line 69
> def DisplayBoard(board):
> """Display board on screen."""
> print "\n\t", board[1], "|", board[2], "|", board[3]
> print "\t", "______"
> print "\t", board[4], "|", board[5], "|", board[6]
> print "\t", "______"
> print "\t", board[7], "|", board[8], "|", board[9], "\n"
>
>
More information about the Tutor
mailing list