Set Methods

 0    18 flashcards    sir
download mp3 print play test yourself
 
Question Answer
Returns a set, that is the intersection of two other sets.
start learning
. intersection() / &
Removes the items in this set that are not present in other, specified set(s).
start learning
. intersection_update() / &=
Returns a set containing the union of sets
start learning
. union() / |
Update the set with the union of this set and others
start learning
. update() / |=
Returns a set containing the difference between two or more sets.
start learning
. difference() / -
Removes the items in this set that are also included in another, specified set.
start learning
. difference_update() / -=
Returns a set with the symmetric differences of two sets
start learning
. symmetric_difference() / ^
Inserts the symmetric differences from this set and another
start learning
. symmetric_difference_update() / ^=
Returns a copy of the set.
start learning
. copy()
Removes all the elements from the set.
start learning
. clear()
Adds an element to the set.
start learning
. add()
Removes the specified element.
start learning
. remove()
Remove the specified item.
start learning
. discard()
Removes an element from the set
start learning
. pop()
Returns whether two sets have a intersection or not.
start learning
. isdisjoint()
Returns whether another set contains this set or not.
start learning
. issubset()
Returns whether this set contains another set or not.
start learning
. issuperset()
Returns the length of a set. (Inner method.)
start learning
. __len__

You must sign in to write a comment