>>> d = {} >>> type(d) >>> d["cat"] = "nine lives" >>> d {'cat': 'nine lives'} >>> print(d["cat"]) nine lives >>> d["dog"] = "six fish" >>> d["parrot"] = "rowdybush" >>> d {'cat': 'nine lives', 'dog': 'six fish', 'parrot': 'rowdybush'} >>> len(d) 3 >>> d["cat"] = "meow mix" >>> d {'cat': 'meow mix', 'dog': 'six fish', 'parrot': 'rowdybush'} >>> d[[1,2,3]] = "foo" Traceback (most recent call last): File "", line 1, in TypeError: unhashable type: 'list' >>> d[(1,2,3)] = "foo" >>> d {'cat': 'meow mix', 'dog': 'six fish', 'parrot': 'rowdybush', (1, 2, 3): 'foo'} >>> d["rule breaker"] = [1,2,3] >>> d {'cat': 'meow mix', 'dog': 'six fish', 'parrot': 'rowdybush', (1, 2, 3): 'foo', 'rule breaker': [1, 2, 3]} >>> hash(d) Traceback (most recent call last): File "", line 1, in TypeError: unhashable type: 'dict' >>> list(d) ['cat', 'dog', 'parrot', (1, 2, 3), 'rule breaker'] >>> for item in d.items(): ... print(item) ... ('cat', 'meow mix') ('dog', 'six fish') ('parrot', 'rowdybush') ((1, 2, 3), 'foo') ('rule breaker', [1, 2, 3]) >>> type(d.items()) >>> s = list(d.items()) >>> s [('cat', 'meow mix'), ('dog', 'six fish'), ('parrot', 'rowdybush'), ((1, 2, 3), 'foo'), ('rule breaker', [1, 2, 3])] >>> for item in d.items(): ... print(item[1]) ... meow mix six fish rowdybush foo [1, 2, 3] >>> for k in d.values(): ... print(k) ... meow mix six fish rowdybush foo [1, 2, 3] >>>