Python Dictionary Methods Flashcards
1
Q
Removes all the elements from the dictionary
A
clear()
2
Q
Returns a copy of the dictionary
A
copy()
3
Q
Returns a dictionary with the specified keys and value
A
fromkeys()
4
Q
Returns the value of the specified key
A
get()
5
Q
Returns a list containing a tuple for each key value pair
A
items()
6
Q
Returns a list containing the dictionary’s keys
A
keys()
7
Q
Removes the element with the specified key
A
pop()
8
Q
Removes the last inserted key-value pair
A
popitem()
9
Q
Returns the value of the specified key. If the key does not exist: insert the key, with the specified value
A
setdefault()
10
Q
Updates the dictionary with the specified key-value pairs
A
update()
11
Q
Returns a list of all the values in the dictionary
A
values()