[Tutor] IndexError: list index out of range [ Program work fine , but gives this message , guidance requested ]
Brian van den Broek
broek at cc.umanitoba.ca
Mon Jan 9 19:48:24 CET 2006
John Joseph said unto the world upon 09/01/06 03:47 AM:
> Hi Brian
> It was a excellent tutorial, Thanks a
> lot for the advice I got my concepts of def of
> functions , sort functions , count , cleared for me
> I was able to do and understand all the
> function example , except “item_comparison” function
> I get the error for set
> >>> set((1,1,1,2,2,2,2,2,3,4,4,5))
> Traceback (most recent call last):
> File "<stdin>", line 1, in ?
> NameError: name 'set' is not defined
>
> my python versrion is
> Python 2.3.4 (#1, Nov 4 2004, 14:06:56)
> [GCC 3.4.2 20041017 (Red Hat 3.4.2-6.fc3)] on linux2
> THANKS
> Joseph John
Joseph,
glad you found the ramble of use :-)
Your python is a version before set was a built-in type (2.4, I
believe). So, the iteration_comparison *and* dupe_detector_5 functions
won't work for you.
2.3 did include the sets module, though.
So, stick
from sets import set
at the top of the code and it ought work.
Best,
Brian vdB
More information about the Tutor
mailing list