Array Imp
Array Imp
Function of
List,Set,Tuple
and Dtctionary
Swipe
Python
Dictionary :
clear(): Removes all the elements from the dictionar
copy(): Returns a copy of the dictionar
fromkeys(): Returns a dictionary with the specified keys
and valu
get(): Returns the value of the specified ke
items(): Returns a list containing a tuple for each key
value pai
keys(): Returns a list containing the dictionary's key
pop(): Removes the element with the specified ke
popitem(): Removes the last inserted key-value pai
setdefault(): Returns the value of the specified key. If
the key does not exist: insert the key, with the specified
valu
update(): Updates the dictionary with the specified key-
value pair
values(): Returns a list of all the values in the dictionar
cmp(): compare two dictionaries
Swipe
Python
SET :
add(): Adds an element to the se
clear(): Removes all the elements from the se
copy(): Returns a copy of the se
difference(): Returns a set containing the difference between two or more
set
difference_update(): Removes the items in this set that are also included in
another, specified se
discard(): Remove the specified ite
intersection(): Returns a set, that is the intersection of two or more 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 no
issubset(): Returns whether another set contains this set or no
issuperset(): Returns whether this set contains another set or no
pop(): Removes an element from the se
remove(): Removes the specified elemen
symmetric_difference(): Returns a set with the symmetric differences of
two set
symmetric_difference_update(): inserts the symmetric differences from
this set and anothe
union(): Return a set containing the union of set
update(): Update the set with another set, or any other iterable
Swipe
Python
List :
sort(): Sorts the list in ascending order
append(): Adds a single element to a list
extend(): Adds multiple elements to a list
index(): Returns the first appearance of the
specified value
max(list): It returns an item from the list with max
value
min(list): It returns an item from the list with min
value
len(list): It gives the total length of the list
list(seq): Converts a tuple into a list
cmp(list1, list2): It compares elements of both lists
list1 and list2
type(list): It returns the class type of an object.
Swipe
Python
Tuple :
cmp(tuple1, tuple2) - Compares elements of both
tuples
len(): total length of the tuple
max(): Returns item from the tuple with max value
min(): Returns item from the tuple with min value
tuple(seq): Converts a list into tuple
sum(): returns the arithmetic sum of all the items in
the tuple
any(): If even one item in the tuple has a Boolean
value of True, it returns True. Otherwise, it returns
False
all(): returns True only if all items have a Boolean
value of True. Otherwise, it returns False
sorted(): a sorted version of the tuple
index(): It takes one argument and returns the index
of the first appearance of an item in a tupl
count(): It takes one argument and returns the
number of times an item appears in the tuple.