On 12/08/2011 04:27 PM, bod...@googlemail.com 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<berma...@cfl.rr.com>
Sender: tutor-bounces+bodsda=googlemail....@python.org
Date: Thu, 08 Dec 2011 16:13:32
To: tutor<tutor@python.org>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  -  Tutor@python.org
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  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to