How d[key]
is getting dictionary values in for loop? I know the other way to write dictionary code in for loop is:
d = {'a': 1, 'b': 2, 'c': 3}
for key, values in d.items():
print (key, 'corresponds to', values)
But I want to know how in below for loop how d[key]
is getting values. Is there dictionary values are getting convert to list? Please help me here.
d = {'a': 1, 'b': 2, 'c': 3}
for key in d:
print (key, 'corresponds to', d[key])