note the use of the dictionary comprehension used to construct the filtered dictionary dictionary comprehensions work in an identical way to the list comprehensions we looked at in python objectstypesand expressions sets sets are unordered collections of unique items sets are themselves mutablewe can add and remove items from themhoweverthe items themselves must be immutable an important distinction with sets is that they cannot contain duplicate items sets are typically used to perform mathematical operations such as intersectionuniondifferenceand complement unlike sequence typesset types do not provide any indexing or slicing operations there are also no keys associated with valuesas is the case with dictionaries there are two types of set objects in pythonthe mutable set object and the immutable frozenset object sets are created using comma-separated values within curly braces by the waywe cannot create an empty set using ={}because this will create dictionary to create an empty setwe write either =set(or =frozenset(methods and operations of sets are described in the following tablemethod operators description len(sreturns the number of elements in copy(returns shallow copy of difference(ts tt returns set of all items in but not in intersection(treturns set of all items in both and isdisjoint(treturns true if and have no items in common issubset(ts < ( !treturns true if all items in are also in issuperset(ts > ( !treturns true if all items in are also in