Python Dictionary Methods Flashcards

1
Q

clear()

A

Removes all the elements from the dictionary

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

copy()

A

Returns a copy of the dictionary

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

fromkeys()

A

Returns a dictionary with the specified keys and value

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

get()

A

Returns the value of the specified key

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

items()

A

Returns a list containing a tuple for each key value pair

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

keys()

A

Returns a list containing the dictionary’s keys

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

pop()

A

Removes the element with the specified key

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

popitem()

A

Removes the last inserted key-value pair

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

setdefault()

A

Returns the value of the specified key. If the key does not exist: insert the key, with the specified value

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

update()

A

Updates the dictionary with the specified key-value pairs

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

values()

A

Returns a list of all the values in the dictionary

How well did you know this?
1
Not at all
2
3
4
5
Perfectly