If Statement Error (Tic Tac Toe)

ale.of.ginger at gmail.com ale.of.ginger at gmail.com
Tue Nov 1 21:20:30 EST 2005


The code's indentation was fine - I forgot to declare cell in player
two's section and not just in player one.

The code (including the win check, for once!) is working.  The last
obstacle is my tie checker; it doesn't seem to like what I have:

if ((gameboard[0:9] is 'X' or 'O') and (win == 0)):
     print "Tie."
     win = 2

Will the [0:9] range not work in this?  Should I write out each option?
 Or is there some way to check if all things in the list are NOT ' '?

I tried

if ((gameboard[0:9] is not ' '))

but it didn't like that - once again maybe the range is the culprit.
Hopefully this will be the last help I need, thanks once again.




More information about the Python-list mailing list