[Tutor] writing a function

hcohen2 hcohen2 at comcast.net
Thu Jan 22 19:19:02 EST 2004


Chris,

The link will take care of the unfixed number of lists, then you need to 
stop duplicates.

When building your final result list, just test to make certain that the 
examined value is not in that list. 

    if fromList(value) not in resultList:
          resultList.append(fromList(value)
    else:
          pass (or continue - you will be in at least one loop here)

orbitz at ezabel.com wrote:

>http://www.python.org/doc/current/tut/node6.html#SECTION006730000000000000000
>
>Start there.
>
>
>On Thu, 22 Jan 2004 14:33:44 -0800 (PST)
>Christopher Spears <cspears2002 at yahoo.com> wrote:
>
>  
>
>>This is a programming problem that I have been given:
>>
>>Write a function that accepts an arbitrary number of
>>lists and returns a single list with exactly one
>>occurrence of each element that appears in any of the
>>input lists.
>>
>>For some reason, this problem has left me stumped. 
>>Suggestions, anyone?
>>
>>-Chris
>>
>>=====
>>"I'm the last person to pretend that I'm a radio.  I'd rather go out and be a color television set."
>>-David Bowie
>>
>>"Who dares wins"
>>-British military motto
>>
>>"Far more creativity, today, goes into the marketing of products than into the products themselves..."
>>-"Pattern Recognition" by William Gibson
>>
>>_______________________________________________
>>Tutor maillist  -  Tutor at python.org
>>http://mail.python.org/mailman/listinfo/tutor
>>    
>>
>
>_______________________________________________
>Tutor maillist  -  Tutor at python.org
>http://mail.python.org/mailman/listinfo/tutor
>
>  
>





More information about the Tutor mailing list