Re: Problem with nested lists as arrays

2005-02-14 Thread Terry Reedy
<[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] 'Having trouble' is too vague to figure out. However, I would delete this: >def getEmptySlot(self): >i = 0 >j = 0 >while i <= self.dim-1: >while j <= self.dim-1: >if self.eleme

Re: Problem with nested lists as arrays

2005-02-14 Thread Diez B. Roggisch
Some general remarks: > def getEmptySlot(self): > i = 0 > j = 0 > while i <= self.dim-1: > while j <= self.dim-1: > if self.elements[j][i] == -1: > return [j, i] > j = j+1 > j = 0 >

Problem with nested lists as arrays

2005-02-14 Thread benjamin . cordes
Hello, For a class modeling the block puzzle I use nested lists as arrays. Within this class there is a method for swaping elements. I have lots of trouble with that method but can't figure it out. It has probably to do with my unuseful approach to nested lists, but I don't want to write the code