Dictionary Methods Flashcards
1
Q
clear()
A
removes all items
2
Q
copy()
A
returns shallow copy of a dictionary
3
Q
fromkeys()
A
creates fictionary from given sequence
4
Q
get()
A
returns value of the key
5
Q
items()
A
returns view of dictionary’s (key, value) pair
6
Q
keys()
A
returns view object of all keys
7
Q
popitem()
A
returns & removes element from dictionary
8
Q
setdefault()
A
inserts key with a value if key is not present
9
Q
pop()
A
removes and returns element having given key
10
Q
values()
A
returns view of all values in dictionary
11
Q
update()
A
updates the dictionary
12
Q
any()
A
checks if any element of an iterable is true
13
Q
all()
A
returns true when all elements in iterable is true
14
Q
ascii()
A
returns string containing printable representation
15
Q
bool()
A
converts a value to Boolean