who do both activities by intersecting the two sets union of such sets would contain either type of individualbut would include any given individual only once this latter property also makes sets ideal for removing duplicates from collections--simply convert to and from set to filter out repeats in factwe relied on such operations in earlier pymailgui in for exampleused intersectionunionand difference to manage the set of active mail downloadsand filtered out duplicate recipients in multiple contexts with set conversion sets are widely relevant tool on practical programs built-in options if you've studied the core python languageyou should already know thatas for stackspython comes with built-in support here as well herethoughthe support is even more direct--python' set datatype provides standard and optimized set operations today as quick reviewbuilt-in set usage is straightforwardset objects are initially created by calling the type name with an iterable or sequence giving the components of the set or by running set comprehension expressionx set('abcde' { for in 'bdxyz' {' '' '' '' '' ' {' '' '' '' '' 'make set from an iterable/sequence same via set comprehension expression once you have setall the usual operations are availablehere are the most common'ein membership true difference {' '' '' ' intersection {' '' ' union {' '' '' '' '' '' '' '' 'interestinglyjust like the dictionariesbuilt-in sets are unorderedand require that all set components be hashable (immutablemaking set with dictionary of items worksbut only because set uses the dictionary iteratorwhich returns the next key on each iteration (it ignores key values) set(['spam''ham''eggs'] {'eggs''ham''spam' {'spam''ham''eggs' {'eggs''ham''spam'sequence of immutables set([['spam''ham']['eggs']]typeerrorunhashable type'listimmutables do not work as items data structures same but set literal if items known