Why Do I Have to Do This to Get the Values of the Keys?


#1

Why do you need to put ‘word’ in to get the values of the keys?


FAQ: Learn Python: A Day at the Supermarket - This is KEY!
#2

because word contains the keys, and to get the values associated with the keys we need to do: dictionary[key]

of course we can get both keys and values if we want:

for key, value in d.iteritems():

or .items() for python3.


#3

That makes so much more sense - thanks!!!