Python 3.7.0 (v3.7.0:1bf9cc5093, Jun 26 2018, 23:26:24) [Clang 6.0 (clang-600.0.57)] on darwin Type "copyright", "credits" or "license()" for more information. >>> d = {"amy":23, "bob":21, "xyz":99} >>> d {'amy': 23, 'bob': 21, 'xyz': 99} >>> d["bob"] 21 >>> d["me"] Traceback (most recent call last): File "", line 1, in d["me"] KeyError: 'me' >>> d["bob"] = 24 >>> d {'amy': 23, 'bob': 24, 'xyz': 99} >>> d["me"] = 1000 >>> d {'amy': 23, 'bob': 24, 'xyz': 99, 'me': 1000} >>> ========== RESTART: /Users/koc/Desktop/test2.py ========== >>> d {'amy': 25, 'bob': 20, 'xyz': 21, 'abc': 99, 'def': 82, 'ghk': 80} >>> for x in d: d[x] = d[x] +1 >>> d {'amy': 26, 'bob': 21, 'xyz': 22, 'abc': 100, 'def': 83, 'ghk': 81} >>> d {'amy': 26, 'bob': 21, 'xyz': 22, 'abc': 100, 'def': 83, 'ghk': 81} >>> d["vulcan"] = [100,200] >>> d {'amy': 26, 'bob': 21, 'xyz': 22, 'abc': 100, 'def': 83, 'ghk': 81, 'vulcan': [100, 200]} >>> d {'amy': 26, 'bob': 21, 'xyz': 22, 'abc': 100, 'def': 83, 'ghk': 81, 'vulcan': [100, 200]} >>> for x in d: print(x, d[x]) amy 26 bob 21 xyz 22 abc 100 def 83 ghk 81 vulcan [100, 200] >>> d[0] Traceback (most recent call last): File "", line 1, in d[0] KeyError: 0 >>> sort(d) Traceback (most recent call last): File "", line 1, in sort(d) NameError: name 'sort' is not defined >>> l = [23,32,33,12] >>> l.sort() >>> l [12, 23, 32, 33] >>> d {'amy': 26, 'bob': 21, 'xyz': 22, 'abc': 100, 'def': 83, 'ghk': 81, 'vulcan': [100, 200]} >>> d = {'amy': 26, 'bob': 21, 'xyz': 22, 'abc': 100, 'def': 83, 'ghk': 81} >>> d {'amy': 26, 'bob': 21, 'xyz': 22, 'abc': 100, 'def': 83, 'ghk': 81} >>> names = [] >>> ages = [] >>> for x in d: names.append(x) ages.append(d[x]) >>> names ['amy', 'bob', 'xyz', 'abc', 'def', 'ghk'] >>> ages [26, 21, 22, 100, 83, 81] >>> 100 in ages True >>> ages.index(100) 3 >>> names[3] 'abc' >>>