[Idle-dev] problem with set(...) in tutor

Douglas S. Blank dblank at brynmawr.edu
Mon Mar 14 15:13:15 CET 2005


Logan,

I believe you need Python 2.4 which added the "set" function.

-Doug

Przemyslaw Kisicki wrote:
> I use:
> --------------------------------------------------------------------------------
> Python 2.3.4 (#2, Aug 19 2004, 15:49:40) [GCC 3.4.1 (Mandrakelinux (Alpha
> 3.4.1-3mdk)] on linux2 ... IDLE 1.0.3
> --------------------------------------------------------------------------------
> I was trying to write:
> --------------------------------------------------------------------------------
> 
>>>>basket=['apple','orange','apple','pear','orange','banana']
>>>>fruits=set(basket)
> 
> --------------------------------------------------------------------------------
> and I get:
> --------------------------------------------------------------------------------
> Traceback (most recent call last): File "<pyshell#322>", line 1, in
> -toplevel- fruits=set(basket) NameError: name 'set' is not defined
> 
> --------------------------------------------------------------------------------
> What's wrong? How to use sets?
> 
> Logan
> _______________________________________________
> IDLE-dev mailing list
> IDLE-dev at python.org
> http://mail.python.org/mailman/listinfo/idle-dev
> 
> 


-- 
Douglas S. Blank,         Assistant Professor
dblank at brynmawr.edu,            (610)526-6501
Bryn Mawr College,   Computer Science Program
101 North Merion Ave,       Park Science Bld.
Bryn Mawr, PA 19010  dangermouse.brynmawr.edu


More information about the IDLE-dev mailing list