[Tutor] Help with excetion handing and making my code more efficient needed please

Luke Paireepinart rabidpoobear at gmail.com
Sat May 19 00:03:43 CEST 2007


Matt Smith wrote:
>>> Is there a better way of doing this?
>>>       
>> Perhaps something like this:
>>
>> for n in (x, x+1, x-1):
>>   for m in (y, y+1, y-1):
>>     if matrix[n, m]:
>>       neighbour_count = neighbour_count + 1
>>
>>     
>
> I need to not text matrix[x][y] is there a simple way to exclude this from the possible combinations of values from the two tuples?
see my other reply, Matt.
-Luke


More information about the Tutor mailing list