Looping over a dictionary


can any one help me to solve this program?


I would think you could print a dynamic statement,

print key, d[key]


in dictionary keys are 'a', 'b', 'c', values are 'apple', 'berry', 'cherry'

i had understood that
print key gives a, b, c
how d[key] gives values. could u plz explain?


Dictionaries are made up of key-value pairs. The key is the object reference for the member, the value is the subscript reference.

d['a'] == 'apple'


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.