Home >>Python Set Methods

Python Set Methods

Python Set Methods

There are more than 15 Python set of built-in methods that can be used on sets.

Method Description
add() It is used to add an element to the set.
clear() It is used to remove all the elements from the set.
copy() It is used to return a copy of the set.
difference() It is used to return a set containing the difference between two or more sets.
difference_update() It is used to remove the items in this set that are also included in another specified set.
discard() It is used to remove the specified item.
intersection() It is used to return a set that is the intersection of two other sets.
intersection_update() It is used to remove the items in this set that are not present in other specified set.
isdisjoint() It is used to return whether two sets have a intersection or not.
issubset() It is used to return whether another set contains this set or not.
issuperset() It is used to return whether this set contains another set or not.
pop() It is used to remove an element from the set.
remove() It is used to remove the specified element in the set.
symmetric_difference() It is used to return a set with the symmetric differences of two sets.
symmetric_difference_update() It is used to insert the symmetric differences from this set and another.
union() It is used to return a set containing the union of sets.
update() It is used to update the set with the union of this set and others.

Learn more about Python Sets Python Sets


Python Set Methods Index

Sr.No. Topics
1 Python Set add() Method
2 Python Set clear() Method
3 Python Set copy() Method
4 Python Set difference() Method
5 Python Set difference_update() Method
6 Python Set discard() Method
7 Python Set intersection() Method
8 Python Set symmetric_difference() Method
9 Python Set symmetric_difference_update() Method
10 Python Set union() Method
11 Python Set update() Method
12 Python Set intersection_update() Method
13 Python Set isdisjoint() Method
14 Python Set issubset() Method
15 Python Set issuperset() Method
16 Python Set pop() Method
17 Python Set remove() Method

No Sidebar ads