2nd week, Emojify assignment

Despite of passing all tests inside the assignment, the grader gives me 0/100 with a bizarre error which says “Cell #8. Can’t compile the student’s code. Error: KeyError(‘potatos’,)”.

I have been stuck with this for a while now, would really appreciate some help.

Thankyou

This is quite a common error.

It means that somewhere in your code, you are referencing the words in the sentence, rather than the words in the dictionary.

Hi Tom, i couldn’t quite comprehend what you meant by that. Could you please elaborate on the same.

Thankyou

“word_to_vec_map” is a dictionary that contains all of the words that are in used in the training set. It’s also known as the vocabulary. The only words from each sentence that you care about are words that are in the dictionary.

For example, it is very common for students to make mistakes in the code that checks whether the words in the sentence are in the word_to_vec_map dictionary.

Greetings everyone.

So the error which was stalling me from finishing up the 2nd week’s 2nd assignment was a simple change in the variable name which i did inside the notebook.

Attaching a screenshot for reference:

Here, i had changed the value of the variable name “word” just to sort of explore the words which were a part of the overall vocabulary. Now, despite of clearing all the tests, the autograder kept failing with the error message, “Cell #8. Can’t compile the student’s code. Error: KeyError(‘potatos’,)”. After a lot of trial and errors and getting help from @Mubsi, i was finally able to figure out that it was a change in that specific variable name’s value (cell block 8) which was causing the autograder to constantly give 0/100.

To all the fellow learners out there, always read the instructions thoroughly before making any changes inside the notebook, otherwise despite of clearing all the tests you might still not clear the assignment and will have a hard time deciphering the error.

Thanks and Regards,
Jay Lodha