Python tutorial
method | description |
union | all elements from both sets |
intersection | elements exists in both sets |
difference | set1-set2, i.e elements from set1, which are not in set2 |
symetric_difference | |
issubset | returns True, when set1 elements contained in set2 |
issuperset | returns True when set2 all elements are contained in set2 |
isdisjoint | |
copy | does shallow-copy |
Both methods are used to remove a element from the Set object.
discard method removes element if found, otherwise do nothing
remove methood also removes element if found, otherwise KeyError exception thrown
ADS