Set Methods Flashcards
remove()
removes element from the set
add()
adds element to a set
copy()
returns shallow copy of a set
clear()
remove all elements from a set
difference()
returns difference of two sets
difference_update()
updates calling set with intersection of sets
discard()
removes an element from the set
intersection()
returns intersection of two or more sets
intersection_update()
updates calling set with intersection of sets
isdisjoint()
checks disjoint sets
issubset()
checks if a set is subset of another set
pop()
remives an arbitrary element
symmetric_difference()
returns symmetric difference
symmetric_difference_update()
updates set with symmetric difference
union()
returns union of sets
update()
add elements to the set
any()
checks if any element of an iterable is true
all()
returns true when all elements in iterable is true
ascii()
returns string containing printable representation
bool()
converts a value to boolean
enumerate()
returns an enumerate object
filter()
constructs iterator from elements which are true
frozenset()
returns immutable frozenset object
iter()
returns iterator for an object
len()
returns length of an object
max()
returns largest element
min()
returns smallest element
map()
applies funciton and returns a list
set()
returns a python set
sorted()
returns sorted list from a given iterable
sum()
add items of an iterable
zip()
returns an iterator of tuples