This is Key - done, but need explanation


The code is fine and I passed the exercise, but! How does it know that I am looking for the values of the keys? I used "definition" if for loop.

Is it because it is in the brackets? Just to confirm - the thing I put into brackets is the value?

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 dictionary in webster:
    print webster[dictionary]


here you declare your for loop:

for dictionary in webster:

dictionary is your iterator, it will contain your keys (aardvak, baa, carpet) so you can use dictionary as key (between square brackets) to get the values


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