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

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • jairodsl

    #1

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

    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

  • James Stroud

    #2
    Re: How can i eval subindex on list[ ][ ] ?

    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

    Comment

    • Terry Reedy

      #3
      Re: How can i eval subindex on list[ ][ ] ?


      "James Stroud" <jstroud@mbi.uc la.eduwrote in message
      news:eojnn5$1vo $1@zinnia.noc.u cla.edu...
      | 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

      Or, if you mean for every i and j, just

      indif == indic

      and let the types equality method do the work for you.



      Comment

      • Gabriel Genellina

        #4
        Re: How can i eval subindex on list[ ][ ] ?

        At Tuesday 16/1/2007 20:08, 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 ???
        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!


        Comment

        • raghu

          #5
          Re: How can i eval subindex on list[ ][ ] ?


          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

          Comment

          Working...