python data structures mathematicallya set is collection of items not in any particular order python set is similar to this mathematical definition with below additional conditions the elements in the set cannot be duplicates the elements in the set are immutable (cannot be modified)but the set as whole is mutable there is no index attached to any element in python set so they do not support any indexing or slicing operation set operations the sets in python are typically used for mathematical operations like unionintersectiondifference and complement etc we can create setaccess its elements and carry out these mathematical operations as shown below creating set set is created by using the set(function or placing all the elements within pair of curly braces days=set(["mon","tue","wed","thu","fri","sat","sun"]months={"jan","feb","mar"dates={ , , print(daysprint(monthsprint(dateswhen the above code is executedit produces the following result please notehow the order of the elements has changed in the result set(['wed''sun''fri''tue''mon''thu''sat']set(['jan''mar''feb']set([ ]accessing values in set we cannot access individual values in set we can only access all the elements together as shown above butwe can also get list of individual elementsby looping through the set days=set(["mon","tue","wed","thu","fri","sat","sun"]