Looping over a dictionary stuck



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)


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


print item1, ' ', item2


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