Week2 A2 - Emojify_v3a Assertion error "finding the 4 words"

I am facing an assertion error in Exercise 1 it says:
`AssertionError: Check that you are finding the 4 words`

Can someone help?

This issue has been solved!

1 Like

Hey @ParthM , glad t hear it is solved.

To help other learners who come across the same issue, can you let us know what did you do to fix this (without giving away the solution code, if any) ? Thanks.

1 Like

Can you tell us the solution please ?

Step 1: Are you sure to make the sentences lowercase and separate them into a list.
construct np.zeros() of the correct form.
set count =0 to count the numbers in a series of numbers, the purpose is to calculate the average
Step 2: ‘w’ will be each value in your words, if any characters are present in your word_to_vec_map. Then we calculate the average

i tried them all and still have the error

Check that you are finding the 4 words

Hey @Mostafa.Ahmed, please don’t share solution code as it is against out code of honour. For now I have removed it from your post.

okay i got it but im trying to have some solutions , spending much of time to try to solve it

Hey @Mostafa.Ahmed. Can you DM me you assignment file ? I’ll take a look. Thanks.

1 Like

when the average is equal to None you have to select from the word_to_vec_map i.e word_to_vec_map[w] then when the count is > 0 then you have to average the avg over the count

1 Like

Tried printing each word and saw all 4 words being checked - I still get this error. Any assistance why that would be the case?

@SUPRIYAM
Perhaps your calculation of the avg value is incorrect.

The assert is triggered if your avg values are wrong. The “finding the 4 words” is just a hint, it might not be your exact problem.

Got it thanks. Problem was with my indentation. Fixed it and it works.

For clarification, do not indent the code block “if count > 0”.
If it is indented, then it become part of the for-loop, and then avg will be computed incorrectly.

At first glance:

• You’re supposed to split the sentence, not “any_word”.

• Also, use “any_word” in the “avg = …” line, not words[0]. You must initialize avg to a word that is in the dictionary, there is no guarantee that all the words in the sentence will be in the dictionary.

Also once you fix the problems, please remove your code. Posting it breaks the course Honor Code.