In [4]:
shapes = ['circle','square','triangle','circle']
In [5]:
setOfShapes = set(shapes)
In [6]:
setOfShapes
Out[6]:
In [7]:
setOfShapes.add('polygon')
In [8]:
setOfShapes
Out[8]:
In [9]:
'circle' in setOfShapes
Out[9]:
In [12]:
'rhombus' in setOfShapes
Out[12]:
In [13]:
favoriteShapes = ['circle','triangle','hexagon']
In [14]:
setOfFavoriteShapes = set(favoriteShapes)
In [15]:
setOfShapes - setOfFavoriteShapes
Out[15]:
In [16]:
setOfShapes & setOfFavoriteShapes
Out[16]:
In [17]:
setOfShapes | setOfFavoriteShapes
Out[17]:
In [ ]: