This is a very common mistake: you are probably directly referencing the global variable word_embeddings
from the body of your get_country
function, instead of referencing it through the formal parameter embeddings
. It works in the notebook, because that’s the value that is actually passed in that one test case. Your code is wrong, because it is not general: it fails when the grader passes a different embeddings dictionary.
Then get_accuracy
also fails, because it calls get_country
.
Just because you pass one set of tests does not mean your code is completely correct.