Python Set Methods
Python Set Methods
Dark code
Tutorials Exercises Get Certified Services Menu Bootcamps Spaces Sign Up Log in
HTML
CSS JAVASCRIPT SQL PYTHON JAVA PHP HOW TO W3.CSS C C++ C# BOOTSTRAP
REACT
Python has a set of built-in methods that you can use on sets.
Method Description
difference() Returns a set containing the difference between two or more sets
difference_update() Removes the items in this set that are also included in another, specified set
intersection_update() Removes the items in this set that are not present in other, specified set(s)
isdisjoint() Returns whether two sets have a intersection or not Dark mode
https://www.w3schools.com/python/python_ref_set.asp k d 1/6
8/26/23, 10:56 PM Python Set Methods
Dark code
issubset()
Tutorials Exercises
Returns whether another set contains this set or not
Get Certified Services Menu Bootcamps Spaces Sign Up Log in
issuperset() Returns whether this set contains another set or not
HTML
CSS JAVASCRIPT SQL PYTHON JAVA PHP HOW TO W3.CSS C C++ C# BOOTSTRAP
REACT
pop() Removes an element from the set
symmetric_difference_update() inserts the symmetric differences from this set and another
update() Update the set with another set, or any other iterable
Dark mode
https://www.w3schools.com/python/python_ref_set.asp k d 2/6