Unit 14 Flashcards

1
Q

14.2 - Dictionary Methods

What does xdict.clear() do?

A

removes all items from the dictionary

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

14.2 - Dictionary Methods

What does xdict.get(key, def) do?

A

finds val of key, if none returns def

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

14.2 - Dictionary Methods

What does xdict.update(ydict) do?

A

merges dictionaries, overwrites duplicate keys

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

14.2 - Dictionary Methods

What does xdict.pop(key, def) do?

A

removes key from dict, returns def if nonexistant

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

14.3 - iterating Over a Dictionary

What is a hash?

A

an int representing a key/value pair for quick lookup

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

14.3 - iterating Over a Dictionary

What does xdict.items() do?

A

displays keys & values as tuples

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

14.3 - iterating Over a Dictionary

What does xdict.keys() do?

A

displays keys

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

14.3 - iterating Over a Dictionary

What does xdict.values() do?

A

displays values

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

14.4 - Dictionary Nesting

What is data structure?

A

a method of organizing data in a logical and cohesive fashion

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