'''sets.py Jeff Ondich, 1/5/09 This program illustrates a few operations using Python's set data type. ''' # Build a couple sets a = set() a.add('cat') a.add('emu') a.add('dog') a.add('cat') # Note what happens here print 'a =', a b = set() b.add('goat') b.add('emu') b.add('moose') print 'b = ', b # Do a few operations on the sets. print 'a intersect b =', a.intersection(b) print 'a union b =', a.union(b) print 'a - b =', a.difference(b) print 'b - a =', b.difference(a) a.update(b) print 'a.update(b) turns a into', a