14/19 - "Looping over a dictionary"


#1

I’ve been staring at this one since yesterday and I just have no idea what to do. I can’t think of anything in my notes so far that might help, and the hint didn’t point me in the right direction.
Instructions and hint:


Initial state of the code:

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

for key in d:
  # Your code here!

I just need to be pointed in the right direction. I would have thought print d[key] might be enough to solve the exercise, but it was not.


#2

You’re almost there.

key, d[key]

#3

Thank you. I would not have thought to do that. It looks simple now that I’ve seen the solution, but print key, d[key] did not even enter my thoughts.

Again, thank you.