Question
Why isn’t my print dictionary solution accepted?
Answer
The most common issues have to do with formatting. Codecademy has tests running behind the scenes to check that your code and output exactly match what is being asked for. For this exercise, we want to print
the key
followed by the value on the same line.
Like the example given: print key, some_dict[key]
.
Be sure not to include another comma at the end since we want each new key-value pair on a new line.
1 Like
Also, the example places a comma after “d[key]”, whereas the Hint example does not. When I removed the comma from after my specific “d[key]”, it accepted my solution.
For me, it was because python 2 apparently formats differently if there are brackets around the print. it worked after I took the brackets out, but it leaves me wondering how to have that formatted to python 3 when python 3 will NOT accept non bracketed print statements.
basically, if your print looks like “print(x)”, change it to be “print x”.