<jupyter_start><jupyter_text><jupyter_code>f = {}
f = {1:'a', 2: 'b'}
g = {'a':[3,45,-4],4.5:{8,9}}

g[4.5], g['a']
s = dict([4,5,6])

r = dict([(1,'x'),(2,'y')])
print(r,type(r),
r[1])
r.get(2)

a = {'id':4,'n':'sam','age':65}
a['id'] = 3
a.get('id')
a['age'] = 27
a
## Remove elements from dict
r.pop(1)
r.popitem(2)
r.clear()
del r
print(r)
w = {1:2,3:4,6:7,8:9,2:33}
q = w.copy()
print(q)
q.items()
q.keys()
q.values()
d = {}
print(dir(d))<jupyter_output>['__class__', '__contains__', '__delattr__', '__delitem__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__getitem__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__iter__', '__le__', '__len__', '__lt__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__setitem__', '__sizeof__', '__str__', '__subclasshook__', 'clear', 'copy', 'fromkeys', 'get', 'items', 'keys', 'pop', 'popitem', 'setdefault', 'update', 'values']<jupyter_text>Iterate dictionary values<jupyter_code>q
for i in q.items():
  print(i)
#check if values are > 2
print([i>2 for i in q.values()])
#Print the key, value pairs wherever value is > 2
print({k:v for k,v in q.items() if v> 2})
print({k + 2 :v * 2 for k,v in q.items() if v>2})<jupyter_output>{5: 8, 8: 14, 10: 18, 4: 66}
{'fraction_non_alphanumeric': 0.26171875, 'fraction_numerical': 0.04453125, 'mean_word_length': 6.404624277456647, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 12, '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': '2', 'dir': 'jupyter-structured-clean-dedup', 'id': '327520', 'license': 'MIT', 'n_tokens_mistral': 622, 'n_tokens_neox': 597, 'n_words': 134, 'path': 'Dictionary.ipynb', 'repo_name': 'samyumobi/A-Complete-Python-Guide-For-Beginners', 'size': '1280'}