Professional Documents
Culture Documents
Lab 5
Lab 5
>>> d = {}
>>> d["tot"] = 2
>>> d
{'tot': 2}
>>> d["pop"] = 60
>>> d
dic = {[1,2,3]:"abc"}
>>> dic
>>> words["car"]
words["car"]
KeyError: 'car'
print(words["cat"])
meow
>>> w = words.copy()
>>> print w
>>> print(w)
>>> print(words)
>>> w.clear()
>>> print(w)
{}
>>> w1.update(dic)
w1.update(dic)
NameError: name 'w1' is not defined
>>> words.update(dic)
>>> words
>>> list(words.items())
>>> list(words.keys())
['house', 'Cat']
>>> list(words.values())
['home', 'meow']
>>> country_specialities
>>> country_specialities_dict
>>> country_specialities
>>> app = {}
{2017: 'February'}
>>> app[2017] = {}
>>> app
{2017: {}}
>>> app[2017]['February'] = 15
>>> app
>>> app[2017]['February'] = {}
>>> app
>>> app
>>> app[2017]['February'] = {}
>>> app
>>> app[2017]['February'][15] = {}
>>> app
>>> app
>>> app
>>> app[2017]['February'][16] = {}
>>> app
{2017: {'February': {16: {}, 15: {'12pm': 'TA office hours', '11am': 'lab'}}}}
>>> app[2017]['February'][16]['12pm'] = 'cs1004 class'
>>> app
{2017: {'February': {16: {'12pm': 'cs1004 class'}, 15: {'12pm': 'TA office hours', '11am': 'lab'}}}}
>>> app[2017]['March'] = {}
>>> app
{2017: {'February': {16: {'12pm': 'cs1004 class'}, 15: {'12pm': 'TA office hours', '11am': 'lab'}}, 'March': {}}}
>>> app[2017]['March'][2] = {}
>>> app[2017]['March
>>>
KeyboardInterrupt
>>> app
{2017: {'February': {16: {'12pm': 'cs1004 class'}, 15: {'12pm': 'TA office hours', '11am': 'lab'}}, 'March': {2:
{'12pm': 'cs1004 final quiz'}}}}
>>> app[2017]['February'][15]
>>>