This is KEY!


#1



#I do not get what is my error:

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

 My error mesage :


Oops, try again. It looks like your code did not print "Goes on the floor.".


This is KEY
#2

Your key in the for loop can be any word, but don't put it in quotes. For example,
for placeholder in dictionary:
print dictionary(placeholder)
where dictionary is the dictionary you are iterating through, and placeholder is any word (no quotes), but it is the same in every instance inside that particular for loop.


#3

@byteace83915,

FOR-IN loop explained

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."
}

you have created a so-called dictionary
which contains key : Value pairs also called =properties=

The description of your webster =dictionary=

The webster =dictionary= consists of 4 properties separated from eachother by a comma-,
an "Aardvark" property with property-key "Aardvark" and an **associated _string Value**
a "Baa" property with property-key Baa and an associated string Value
a "Carpet" property with property-key "Carpet" and an associated string Value
a "Dab" property with property-key "Dab" and an associated string Value

FOR - IN loop explained

The FOR-IN loop will iterate over a given dictionary
and at every iteration the FOR-IN will
assign the property-key to a variable-name of your choice

Thus if we would use

for propKey in webster:

we would get
iteration-1 propKey = "Aardvark"
iteration-2 propKey = "Baa"
iteration-3 propKey = "Carpet"
iteration-4 propKey = "Dab"

Now if they ask you to print the property-key's
you would use

for propKey in webster:
    #notice the 4 space indention
    print propKey

If they ask you to print the associated Value

for propKey in webster:
    #notice the 4 space indention
    #
    # getting access to the =assocated-Value= using the =bracket-notation=
    print webster[propKey]

================================================

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."
}
print webster['Aardvark']
# Add your code below!
count = 0
for a_variable in webster:
    count+=1
    print("====Iteration{0}".format(count))
    propKey = a_variable
    assoValue = webster[propKey]
    print("property ={0}= has an associated-Value\n\t {1}".format(propKey,assoValue))