443,660 Members | 1,102 Online
Need help? Post your question and get tips & solutions from a community of 443,660 IT Pros & Developers. It's quick & easy.

# How can i eval subindex on list[ ][ ] ?

 P: n/a Excuse me, i was trying in too many ways but i couldnt access subindex on a list , the problem is the next: I have indif=[[0,'A'],[1,'B'],[2,'C'],[3,'D']] and indic=[[0,'B'],[1,'C'],[2,'D'],[3,'E']] i need to eval if indic[i][j] is equal to indif[i][j] I used a double for but i had got "list index out of range". How can i do ??? Thanks a lot, Cordially, jDSL Jan 16 '07 #1
4 Replies

 P: n/a jairodsl wrote: Excuse me, i was trying in too many ways but i couldnt access subindex on a list , the problem is the next: I have indif=[[0,'A'],[1,'B'],[2,'C'],[3,'D']] and indic=[[0,'B'],[1,'C'],[2,'D'],[3,'E']] i need to eval if indic[i][j] is equal to indif[i][j] I used a double for but i had got "list index out of range". How can i do ??? Thanks a lot, Cordially, jDSL pyi = 1 pyj = 0 pyindif[i][j] == indic[i][j] True Works for me. James Jan 16 '07 #2

 P: n/a "James Stroud" | I have | > | indif=[[0,'A'],[1,'B'],[2,'C'],[3,'D']] | > | and | > | indic=[[0,'B'],[1,'C'],[2,'D'],[3,'E']] | > | i need to eval if indic[i][j] is equal to indif[i][j] | > | I used a double for but i had got "list index out of range". How can i | do ??? | > | Thanks a lot, | > | Cordially, | > | jDSL | > | | pyi = 1 | pyj = 0 | pyindif[i][j] == indic[i][j] | True Or, if you mean for every i and j, just indif == indic and let the types equality method do the work for you. Jan 17 '07 #3

 P: n/a At Tuesday 16/1/2007 20:08, jairodsl wrote: >Excuse me, i was trying in too many ways but i couldnt access subindexon a list , the problem is the next:I haveindif=[[0,'A'],[1,'B'],[2,'C'],[3,'D']]andindic=[[0,'B'],[1,'C'],[2,'D'],[3,'E']]i need to eval if indic[i][j] is equal to indif[i][j]I used a double for but i had got "list index out of range". How can ido ??? Posting your actual code would help. indif[i][j] should be fine, if i is between 0 and 3 inclusive, and j is 0 or 1. -- Gabriel Genellina Softlab SRL __________________________________________________ Preguntá. Respondé. Descubrí. Todo lo que querías saber, y lo que ni imaginabas, está en Yahoo! Respuestas (Beta). ¡Probalo ya! http://www.yahoo.com.ar/respuestas Jan 17 '07 #4

 P: n/a its working for me i think its better to mention the value of i and j for both lists or you might have done mistake while formatting strings it should be %s for strings and %d for numbers if any subelement in lists does not formatted properly it may lead to error Jan 17 '07 #5

### This discussion thread is closed

Replies have been disabled for this discussion.