"Ben Ganzfried" <ben.ganzfr...@gmail.com> wrote

if (cell % 3 == 0) and (self.__mycells[cell] == self.__mycells[cell +
1]) and (self.__mycells[cell + 1]== self.__mycells[cell + 2]):
TypeError: unsupported operand type(s) for %: 'instance' and 'int'

The error is in the first expression and the message tells you
what is wrong. You are trying to use the % operator on an
instance.

Looking at your code, sure enough...

   def gameWon(self):
       for cell in self.__mycells:
           if (cell % 3 == 0) and (self.__mycells[cell] ==

cell is one of __mycells which are objects.

You need to rethink this test.

HTH,


--
Alan Gauld
Author of the Learn to Program web site
http://www.alan-g.me.uk/


_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to