Python 3.13.6 (tags/v3.13.6:4e66535, Aug 6 2025, 14:36:00) [MSC v.1944 64 bit (AMD64)] on win32 Enter "help" below or click "Help" above for more information. person_1 = { "name": "Jane", "dob": "12/08/1997", "city": "Houston" } person_1.get('name', 'some stranger') 'Jane' person_2 = { "fname": "Jane", "dob": "12/08/1997", "city": "Houston" } person_2 {'fname': 'Jane', 'dob': '12/08/1997', 'city': 'Houston'} person_2.get('name', 'some stranger') 'some stranger' person_2['name'] Traceback (most recent call last): File "", line 1, in person_2['name'] KeyError: 'name' person_3 = { "fname": "Joseph", "dob": "12/07/2011", "city": "Dallas" } person_1 {'name': 'Jane', 'dob': '12/08/1997', 'city': 'Houston'} person_3 {'fname': 'Joseph', 'dob': '12/07/2011', 'city': 'Dallas'} person_1.update(person_3) person_3 {'fname': 'Joseph', 'dob': '12/07/2011', 'city': 'Dallas'} person_1 {'name': 'Jane', 'dob': '12/07/2011', 'city': 'Dallas', 'fname': 'Joseph'} d1 = {'a': 12, 'b':20} d1 {'a': 12, 'b': 20} k = d1.keys() k dict_keys(['a', 'b']) for item in k: print(item) a b d1['c'] = 'hello' d1 {'a': 12, 'b': 20, 'c': 'hello'} for item in k: print(item) a b c da = {'a': 2, 'the': 4} # count the occurences of word. da {'a': 2, 'the': 4} da['hello'} = 3 SyntaxError: closing parenthesis '}' does not match opening parenthesis '[' da['hello'] = 3 da {'a': 2, 'the': 4, 'hello': 3} da['hello'] += 1 # da['hello'] = da['hello'] + 1 da {'a': 2, 'the': 4, 'hello': 4} db = {'bird': 2, 'monkey':4} db {'bird': 2, 'monkey': 4} da.update(db) da {'a': 2, 'the': 4, 'hello': 4, 'bird': 2, 'monkey': 4} da.update({'monkey': 25, 'tiger': 7}) da {'a': 2, 'the': 4, 'hello': 4, 'bird': 2, 'monkey': 25, 'tiger': 7} dc = {'a': 10, 'e': 'hey;} SyntaxError: unterminated string literal (detected at line 1) dc = {'a': 10, 'e': 'hey'} dc {'a': 10, 'e': 'hey'} len(dc.keys()) 2 dc['f'] = [1,3,5,6] dc {'a': 10, 'e': 'hey', 'f': [1, 3, 5, 6]} len(dc.keys()) 3 dc['f'] = "I like a string now.' dc dc['f'] = "I like a string now." dc {'a': 10, 'e': 'hey', 'f': 'I like a string now.'} len(dc.keys()) 3 dc['f'] = {'s1': [1,3,5,6], 100: {'x': 1, 'y':2}} dc {'a': 10, 'e': 'hey', 'f': {'s1': [1, 3, 5, 6], 100: {'x': 1, 'y': 2}}} len(dc.keys()) 3 dc['f'] {'s1': [1, 3, 5, 6], 100: {'x': 1, 'y': 2}} dc['f']['s1'] [1, 3, 5, 6] dc['f']['s1'][1] 3 dc['f'] ... {'s1': [1, 3, 5, 6], 100: {'x': 1, 'y': 2}} >>> dc['f'][100] ... {'x': 1, 'y': 2} >>> dc['f'][100]['y'] ... 2 >>> dc['f']['s1'][1:4] ... [3, 5, 6] >>> dc ... {'a': 10, 'e': 'hey', 'f': {'s1': [1, 3, 5, 6], 100: {'x': 1, 'y': 2}}} >>> my_set = {1, 2, 3, 4, 4, 5} ... >>> my_set ... {1, 2, 3, 4, 5} >>> my_list = [1,2,3,2,3,,1] ... SyntaxError: invalid syntax >>> my_list = [1,2,3,2,3,1] ... >>> my_list ... [1, 2, 3, 2, 3, 1]