FUNCTION
|
DESCRIPTION
|
add()
|
Adds an element to a set
|
remove()
|
Removes an element from a set. If the element is not present in the
set, raise a KeyError
|
clear()
|
Removes all elements form a set
|
copy()
|
Returns a shallow copy of a set
|
pop()
|
Removes and returns an arbitary set element. Raise KeyError if the
set is empty
|
update()
|
Updates a set with the union of itself and others
|
union()
|
Returns the union of sets in a new set
|
difference()
|
Returns the difference of two or more sets as a new set
|
difference_update()
|
Removes all elements of another set from this set
|
discard()
|
Removes an element from set if it is a member. (Do nothing if the
element is not in set)
|
intersection()
|
Returns the intersection of two sets as a new set
|
intersection_update()
|
Updates the set with the intersection of itself and another
|
isdisjoint()
|
Returns True if two sets have a null intersection
|
issubset()
|
Returns True if another set contains this set
|
issuperset()
|
Returns True if this set contains another set
|
symmetric_difference()
|
Returns the symmetric difference of two sets as a new set
|
symmetric_difference_update()
|
Updates a set with the symmetric difference of itself and another
|
key in s
|
Checks whether the key is
present in the set or not. Returns True if the key is present in the key
otherwise False is returned.
|
key not in s
|
Checks whether the key is not
present in the set or not. Returns True if the key is not present in the key
otherwise False is returned.
|
s1 == s2
|
Checks the equality of two
sets.
|
s1 != s2
|
Checks the inequality of two
sets.
|
s1 <= s2
|
Returns True if s1 is subset of s2
|
s1 < s2
|
Returns True if s1 is proper subset of s2
|
s1 >= s2
|
ReturnsTrue if s1 is superset of s2
|
s1 > s2
|
Returns True if s1 is proper superset of s2
|
s1 | s2
|
Returns a set with all the allements of s1 and s2
|
s1 & s2
|
Returns a set contianing elements present in both the sets
|
s1 – s2
|
Returns a set with elements present in s1 but not s2
|
s1 ˆ s2
|
Returns a set with elements in both the set excluding the common
elements
|
No comments:
Post a Comment