Coursera Grading Error

You are making the most common error on this assignment: you are referencing the global variable word_embeddings in the local scope of the get_country function. You should be referencing the actual formal parameter of the function which is the variable embeddings. Your code works in the notebook, because that happens to be the variable that gets passed as the embeddings argument. But it’s a bug, which you see because the grader passes a different embeddings dictionary and it fails.

Then the get_accuracy function also fails in the grader because it calls get_country.

2 Likes