1# Basic syntax:
2len(set(my_list))
3# By definition, sets only contain unique elements, so when the list
4# is converted to a set all duplicates are removed.
5
6# Example usage:
7my_list = ['so', 'so', 'so', 'many', 'duplicated', 'words']
8len(set(my_list))
9--> 4
10
11# Note, list(set(my_list)) is a useful way to return a list containing
12# only the unique elements in my_list
1mylist = ['nowplaying', 'PBS', 'PBS', 'nowplaying', 'job', 'debate', 'thenandnow']
2myset = set(mylist)
3print(myset)
4
1words = ['a', 'b', 'c', 'a']
2unique_words = set(words) # == set(['a', 'b', 'c'])
3unique_word_count = len(unique_words) # == 3
4
1len(set(["word1", "word1", "word2", "word3"]))
2# set is like a list but it removes duplicates
3# len counts the number of things inside the set