On 12/08/2011 04:27 PM, [email protected] wrote:
That won't work because l1[0] is ['a', 1]
What happens if you don't change the code?
l1.index('c')
Bodsda
Sent from my BlackBerry® wireless device
-----Original Message-----
From: Robert Berman<[email protected]>
Sender: [email protected]
Date: Thu, 08 Dec 2011 16:13:32
To: tutor<[email protected]>In [1]: l1=[['a',1],['b',2],['c',3]]
In [2]: l1
Out[2]: [['a', 1], ['b', 2], ['c', 3]]
In [3]: l1.index('c')
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
/home/bermanrl/<ipython console> in<module>()
ValueError: 'c' is not in list
Subject: [Tutor] list.index() question
_______________________________________________
Tutor maillist - [email protected]
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor
Bodsa et al,
What happens is as follows:
In [1]: l1=[['a',1],['b',2],['c',3]]
In [2]: l1
Out[2]: [['a', 1], ['b', 2], ['c', 3]]
In [3]: l1.index('c')
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
/home/bermanrl/<ipython console> in <module>()
ValueError: 'c' is not in list
I really appreciate the help I am getting. Eventually I am certain there
is a relatively easy solution I simply do not have the expertise to see it.
Robert
_______________________________________________
Tutor maillist - [email protected]
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor