1d = {'key':'value'}
2print(d)
3# {'key': 'value'}
4d['mynewkey'] = 'mynewvalue'
5print(d)
6# {'mynewkey': 'mynewvalue', 'key': 'value'}
7
1thisdict = {
2 "brand": "Ford",
3 "model": "Mustang",
4 "year": 1964
5}
6thisdict["color"] = "red"
7print(thisdict)
1d = {'a': 1, 'b': 2}
2print(d)
3d['a'] = 100 # existing key, so overwrite
4d['c'] = 3 # new key, so add
5d['d'] = 4
6print(d)
1mydict = {'score1': 41,'score2': 23}
2mydict['score3'] = 45 # using dict[key] = value
3print(mydict)