Everyone should be familiar with sets from mathematics. If not, a set is a pile of unordered, non-duplicated elements.
Sets need initialized with the elements of a list. As you now know what a list is, this can be done simply. Again, print can handle a set as it is.
Once a set is created we can perform the most useful feature of sets - testing whether an element exists:
shopping_list=set(['cheese', 'milk', 'beef'])
print shopping_list
# returns set(['cheese', 'milk', 'beef'])
print 'milk' in shopping_list
# returns 'True'
Sets are only interesting if we have more that one of them! With two sets we can see the elements that both sets contain, this is called an "intersection".
christmas_shopping_list=set(['crackers', 'beef', 'pudding', 'tree'])
print shopping_list & christmas_shopping_list
# returns 'set(['beef'])'
Also, we can perform the union of sets ( | ), difference ( - ), or symmetric difference ( ^ ).
That's pretty much it for sets, using the above examples you can do anything. For example, add a new element, you can use union.
shopping_list = shopping_list | set(['biscuits'])