Dictionaries
Dictionaries
DICTIONARIES
associates a set of keys with data values
a dictionary is a mapping between a set of keys
and a set of values
Each key
maps to a value.
The association of a key and a value is called a
key-value pair, sometimes called an item or an
entry
written as a sequence of key/value pairs
separated by commas and the entire
sequence is enclosed in a pair of braces
key is separated from its value by a colon (:)
Traversing a dictionary using for
loop
Inserting keys and updating key
values
REMOVING KEYS
s.get()
dict.pop(key)
dict.pop(key,default)
dict.keys(),dict.values,dict.items(),dict.clear()
Dictionary aliasing and copying