2. this is key!


#1

'''
webster = {
"Aardvark" : "A star of a popular children's cartoon show.",
"Baa" : "The sound a goat makes.",
"Carpet": "Goes on the floor.",
"Dab": "A small amount."
}

Add your code below!

for d in webster:
print webster[d]
'''
I don't understand why this prints out the definition


#3

Hello, @joey4242!
Whenever we iterate through a dictionary, we'll access the keys and if we want to print them all we have to do is:

for dictionaryKey in webster:
     print dictionaryKey

But if we want to print the value stored into that key, we'll have to print

webster[dictionaryKey]

.
This is due the fact you're iterating through the keys and whenever you do this, you're saying:
"In this dictionary, webster, access the key value stored in dictionaryKey and print out the value in it."

Hope it's clear now!

Best regards,
g4be


#4

so it goes (key : value) ??


#5

so the code:

will give me the (:value) ???


#6

Yes, that's how dictionaries work.
To print the key, all you have to do is to print the variable you are using to iterate through the dictionary but if you want to print the value, use name_of_the_dictionary[name_of_the_key]


#7

Yes, it will get you the value.