basket = ['apple', 'orange', 'apple', 'pear', 'orange', 'banana'] fruit = set(basket) # create a set without duplicates print fruit print 'orange' in fruit # fast membership testing print 'crabgrass' in fruit