<jupyter_start><jupyter_text>Python Dicionaries  Dict Hash Table Series of key:value pairs within braces {} e.g. dict['foo'] looks up the value under the key foo* Key: can be of type strings, numbers, tuples* Value: can be of any type* Strings and Tuples work cleanly for Keys since they are immutable<jupyter_code>dict = {}
dict['a'] = 'alpha'
dict['g'] = 'gamma'
dict['o'] = 'omega'
print dict
print dict['a']
dict['a'] = 6
'a' in dict
print dict['z']
if 'z' in dict:print dict['z']
print dict.get('z')<jupyter_output>None<jupyter_text>Iteration over dictionaries<jupyter_code>for key in dict: print key# keys are in random order
for key in dict.keys(): print key
print dict.keys()
print dict.values()
# loop over keys in sorted order
for key in sorted(dict.keys()):
    print key,dict[key]<jupyter_output>a 6
g gamma
o omega<jupyter_text>Dict Formatting % operator works to substitute values from dict into a string by name<jupyter_code>hash = {}
hash['word'] = 'garfield'
hash['count'] = 42
print hash
s = 'I want %(count)d copies of %(word)s'%hash
print s<jupyter_output>I want 42 copies of garfield<jupyter_text>Del Operator "del" operator can remove the definition of a variable, as if it had not been defined. Del can also be used on list elements or slices to delete that part of the list and to delete entries from dictionary.<jupyter_code>var = 6
print var
del var
print var
list = ['a','b','c','d']
print list
del list[0]
print list
del list[-2:0]
print list
dict = {'a':1,'b':2,'c':3}
print dict
del dict['b']
print dict<jupyter_output>{'a': 1, 'c': 3}
{'fraction_non_alphanumeric': 0.12396166134185303, 'fraction_numerical': 0.009584664536741214, 'mean_word_length': 5.418032786885246, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '4', 'dir': 'jupyter-structured-clean-dedup', 'id': '216550', 'license': 'Apache-2.0', 'n_tokens_mistral': 547, 'n_tokens_neox': 529, 'n_words': 212, 'path': 'dictionaries.ipynb', 'repo_name': 'veranki/google-python-exercises', 'size': '1565'}