Why does this work? ex 2 this is KEY



I don't understand why this code works. Please someone explain.

I'm sure its not supposed to work as it states in the instructions that it will read out definitions of the words and the console only outputs the 4 words and none

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


this will loop over the dictionary:

for webster in webster:

I wouldn't give the iterator the same name as the dictionary.

Anyway, webster gets assigned all keys of the dictionary, and you print them

Just ignore the None


Thanks, I'll keep that in mind.


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