[Tutor] writing a function

Alan Gauld alan.gauld at blueyonder.co.uk
Fri Jan 23 03:18:09 EST 2004


> 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?

Assuming the hard bit is how to get a function with 
an arbitrary number of lists as argument then go look 
at the *args stuff in the official tutor.

One you have your list of lists the rest can be done 
easily using a dictionary or, in 2.3, the new set type.

Alan G.



More information about the Tutor mailing list