Why does key print the value?



Why does key print the value?


We are using key as exactly that - the current key name that our loop is on. Recall that when we write dictionary_name[key_name], it provides us with the value stored under that key name in that dictionary. So that’s exactly what we accomplish by writing print dictionary[key] inside of our for loop!

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