- Sets in Python are used when we are primarily interested in operations that we know from sets in mathematics.
- In day to day speach we often use the word "group" instead of "set" even though they are not the same.
- What are the common elements of two set (two groups)
- Is one group (set) the subset of the other?
- What are all the elements that exist in both groups (sets)?
- What are the elements that exist in exactly one of the groups (sets)?
from __future__ import print_function things = set(['table', 'chair', 'door', 'chair', 'chair']) print(things) # set(['table', 'chair', 'door']) if 'table' in things: print("has table")
set(['table', 'chair', 'door']) has table