Learn Python practically
and Get Certified.
Reference Materials
Certification Courses
Created with over a decade of experience and thousands of feedback.
Learn Python practically
and Get Certified.
Try Programiz PRO!
Learn Python practically
and Get Certified.
Python Set Methods
A set is an unordered collection of items. Set items are unique and immutable. In this reference page, you will find all the methods that a set object can use.
Python frozenset()
returns immutable frozenset object
Python Set add()
adds element to a set
Python Set clear()
remove all elements from a set
Python Set copy()
Returns Shallow Copy of a Set
Python Set difference()
Returns Difference of Two Sets
Python Set difference_update()
Updates Calling Set With Intersection of Sets
Python Set discard()
Removes an Element from The Set
Python Set intersection()
Returns Intersection of Two or More Sets
Python Set intersection_update()
Updates Calling Set With Intersection of Sets
Python Set isdisjoint()
Checks Disjoint Sets
Python Set issubset()
Checks if a Set is Subset of Another Set
Python Set issuperset()
Checks if a Set is Superset of Another Set
Python Set pop()
Removes an Arbitrary Element
Python Set remove()
removes the specified element from the set
Python Set symmetric_difference()
Returns the symmetric difference of sets
Python Set symmetric_difference_update()
Updates the Set with symmetric difference
Python Set union()
Returns the union of sets
Python Set update()
Add elements to the set