[Tutor] results not quite 100 percent yet

Kent Johnson kent37 at tds.net
Wed Jan 30 03:26:05 CET 2008


bhaaluu wrote:
>     if keY == 6 or keY == 11 or tablE.values()[keY-1][6] != 0:
>         tablE.values()[5][6] = 0
>         tablE.values()[10][6] = 0

This is not the right way to access the values of a dict. tablE.values() 
is a list of the values in tablE, but it is not in the order you expect; 
it is easiest to think that it is in a random or indeterminate order.

Try
     if keY == 6 or keY == 11 or tablE[keY-1][6] != 0:
         tablE[5][6] = 0
         tablE[10][6] = 0

etc.

Kent

PS what's with the strange capitalization of variable names?


More information about the Tutor mailing list