3/18 The 'in' operator: ERROR


#1

Link: https://www.codecademy.com/en/courses/python-beginner-en-KAgt5/0/3?curriculum_id=4f89dab3d788890003000096

The error message: "Oops, try again. Your code did not print out every key in my_dict.

I imagine the code is fine as it gives the desired output.


my_dict = {
    "color": "red",
    "price": "96",
    "size": "M"
    }
print my_dict.keys()
print my_dict.values()

for eachkey in my_dict:
    print" %s %s" % (eachkey, my_dict[eachkey])


#2

the exercise doesn't like the way you use print in the for loop, you should just separate the variable with a comma:

print eachkey,my_dict[eachkey]

it seems the %s you use is not appreciated by the exercise


#3

That's weird, it does give the right answer and plays by the rules of the exercise...
Will codecademy be fixing this?


#4

We can't cover al possible correct answer, we do our best, but we can catch all. I mean, you have your method, plus the method i demonstrated, and i can think of a third method (format), that is 3 methods for just a silly printout.

We can't cover all those cases.


The 'in' Operator: Remove the comma