The 'in' Operator: Remove the comma


#1

Dear moderators: I ran into the same issue as others here, where I completed "The 'in' Operator" exercise successfully, but got the "Oops!" error, because I had an extra comma after the 'values' in my dictionary. See example below:

my_dict = {
"chicken": 15,
"fish": 12,
"beef": 18
}
print my_dict.keys()
print my_dict.values()

for i in my_dict:
print i, my_dict[i], ### <<< remove this comma to make this code work

My recommendation is to 1. remove this extra comma from the code example (since that's what we are following). However, if this is valid code, then 2. the acceptable answer should be fixed :slight_smile:

I understand you "cant catch all the possible solutions". However, I feel like the example should work... Anyway, I love the site. Thanks for doing what u do!

Continuing the discussion from 3/18 The 'in' operator: ERROR:



Replace this line with your code.


#2

Thank you for reporting the problem, we recognise this is something that needs improvement, however as it does not prevent users from passing the lesson and this is one of the older courses it is unlikely this will be improved. Thank you for taking the time to inform us though, we would like everything to be improved just as much as you would!


#3