Sets in Python
Sets A set is unordred collection of items with no duplicate. It can be used to eliminating duplicates or membership testing. Set also supports union, intersection, difference and symmetric difference. Set can be initialized using set(). Set can be initialized using set(). set1 = set() Set has following methods set.add(element) Add element to set. If element already present nothing happens. set.clear() Remove all elements and clear the set. set.copy() Returns shallow copy set. set.difference(another_set[s]) Returns the difference of two or mor e sets as new set. set.difference_update(another_set) Remove all elements of another from this set. set.discard(element) Remove an element from set if is a member. set.intersection(another_set[s]) ...