Mapping type Flashcards
1
Q
What is a dictionary container ?
A
A Python container used to describe associative relationships.
2
Q
Dictionary container syntax
A
Dict_name = {‘key’: value, ‘key’: value}
3
Q
True or false. Dict object types are mutable.
A
True
4
Q
What are the two aspects of a dict type ?
A
key: value pairs
5
Q
Why use dict ?
A
Dictionaries are typically used in place of lists when an associative relationship exists.
6
Q
How to access and element in a dict.
A
Dict_name[‘key’]
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