Your shopping cart is empty!
Sets are unordered collections of simple objects. These are used when the existence of an object in a collection is more important than the order or how many times it occurs.
Using sets, you can test for membership, whether it is a subset of another set, find the intersection between two sets, and so on.
>>> bri = set(['brazil', 'russia', 'india'])
>>> 'india' in bri
>>> 'usa' in bri
>>> bric = bri.copy()
>>> bri & bric # OR bri.intersection(bric)
How It Works:
The example is pretty much self-explanatory because it involves basic set theory mathematics taught in school.