It says the code is correct but I have my concerns


#1


https://www.codecademy.com/courses/python-beginner-en-IZ9Ra/0/2?curriculum_id=4f89dab3d788890003000096#


The code did not print the items.

File "python", line 10
print [*]
^
SyntaxError: invalid syntax

I expected the code to print. it says good job and allows me to move on but it is incorrect.


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


#2

In this part of code, You have to loop over the dictionary and print the values of dictionary,

for example from theory of this exercise..

# A simple dictionary
d = {"foo" : "bar"}

for key in d: 
    print d[key]  # prints "bar"

You can see we iterate over dictionary and our iterator gets value of keys of dictionary and we simply use bracket operator and key to find corresponding value.


#4

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

'''


#5

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