Docsity

Python Set Methods: A Comprehensive Guide, Summaries of Programming Languages

Toggle sidebar
bg1
Python Set Methods
MethodDescription
Add() Adds an element to the set
Clear() Removes all the elements from the set
Copy() Returns a copy of the set
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
Discard() Remove the specified item
Intersection() Returns a set, that is the intersection of two other sets
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
Issubset() Returns whether another set contains this set or not
Issuperset() Returns whether this set contains another set or not
Pop() Removes an element from the set
Remove() Removes the specified element
Symmetric_difference() Returns a set with the symmetric differences of two sets
Symmetric_difference_update() inserts the symmetric differences from this set and another
Union() Return a set containing the union of sets
Update() Update the set with another set, or any other iterable

Partial preview of the text

Download Python Set Methods: A Comprehensive Guide and more Summaries Programming Languages in PDF only on Docsity!

Python Set Methods MethodDescription Add() Adds an element to the set Clear() Removes all the elements from the set Copy() Returns a copy of the set 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 Discard() Remove the specified item Intersection() Returns a set, that is the intersection of two other sets 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 Issubset() Returns whether another set contains this set or not Issuperset() Returns whether this set contains another set or not Pop() Removes an element from the set Remove() Removes the specified element Symmetric_difference() Returns a set with the symmetric differences of two sets Symmetric_difference_update() inserts the symmetric differences from this set and another Union() Return a set containing the union of sets Update() Update the set with another set, or any other iterable