Dictionaries
Create a dictionary to store employee record
D = {‘name’: ‘Bob’, ‘age’: 25, ‘job’: ‘Dev’, ‘city’: ‘New York’, ‘email’: ‘bob@web.com’}
When do you use Dictionaries vs. list?
prices_lookup = {‘apple’:2.99, ‘oranges’:1.99, ‘milk’:5.80}
Call the price of apple
milk
oranges
prices_lookup[‘apple’]
2.99
prices_lookup[‘milk’]
5.80
prices_lookup[‘oranges’]
1.99
Dictionaries are mappings and do not retain order!
Given d={‘k1’:[1,2,3]}
What is the output of d[‘k1’][1]
2
Is this statement True or False? Dictionaries are immutable.
False