Mapping type Flashcards

1
Q

What is a dictionary container ?

A

A Python container used to describe associative relationships.

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

Dictionary container syntax

A

Dict_name = {‘key’: value, ‘key’: value}

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

True or false. Dict object types are mutable.

A

True

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

What are the two aspects of a dict type ?

A

key: value pairs

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

Why use dict ?

A

Dictionaries are typically used in place of lists when an associative relationship exists.

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

How to access and element in a dict.

A

Dict_name[‘key’]

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

What are the dict methods ?

A

dict[k] = v adds new value if k does not already exist.

dict[k] = v updates k value if k already exists

del del dict[k] deletes k value

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