Sets
Using Sets in Python 3
# Set definition examples:
example_set1 = {1, 2, 3}
example_set2 = {'h','e','l','l','o'}
print('example_set1:', example_set1)
print('example_set2:', example_set2) # Notice there is only 1 'l'; Also notice the order of the values outputted
print('--')
singleton_set = {7}
empty_set = set() # this is because {} is reversed for a different feature in python 3.
print('Singleton:', singleton_set)
print('Empty Set:', empty_set)Powering Up Sets: Set Operators
Disjoint: A Set Behaviour Property
Set Operators as Methods
Set Comprehension
Ending Notes on Sets for Python
Last updated