Looping over a dictionary stuck


#1


https://www.codecademy.com/courses/python-beginner-en-cxMGf/2/1?curriculum_id=4f89dab3d788890003000096

Oops, try again. It looks like your code did not print "b berry".

Berry and b are both printing but I'm still getting the error. I'm stuck here and looking for some guidance to walk me through it. I see there are other posts about this issue, but the responses/solutions are a bit inconsistent which prompted me to start this threat. Cheers.


d = {'a': 'apple', 'b': 'berry', 'c': 'cherry'}

for key in d:
    # Your code here!
    print (d[key], key)


#2

It needs a space.
Pass a space between them by passing second item of print as ' ' (space)
also get rid of () .

hint**

print item1, ' ', item2


#3

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