Set methods in python



set is a unorder collection and it's used to remove the duplicate element.








S.No Methods Explain
add() To add the element in the set.
clear() To empty the set.
copy() To copy the elements from one set to another set.
difference() To find the element which is not common in given two set.
difference_update() To update the element which is not common in given two set.
discard() To remove the specified element in the set.
intersection() To find the element which is common in the given two set.
intersection update() To update the element which is common in the given two set.
isdisjoint() To find whether each and every element in the given sets are uncommon.
issubset() To find whether the all the elements in the 1st specified set is is available in the another set.
issuperset() To find whether the all the elements in the 2nd specified set is available in the another set.
pop() It will remove any element in the set.
remove() To remove the specified element in the set.
symmetric difference() To find the uncommon elements in the given two set.
symmetric difference update() To find the uncommon elements in the given two set and update the elements in the specified set.
union() To find all the elements in the given two list.
update() To find all the elements in the given two list.