Error in course 5 week 2 exercise 1

here is the error attached

avg = 
 [0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0.
 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0.
 0. 0.]
---------------------------------------------------------------------------
AssertionError                            Traceback (most recent call last)
<ipython-input-58-cd40edd34d98> in <module>
     25     print("\033[92mAll tests passed!")
     26 
---> 27 sentence_to_avg_test(sentence_to_avg)
     28 
     29 # END UNIT TEST

<ipython-input-58-cd40edd34d98> in sentence_to_avg_test(target)
     15     avg = target("a a_nw c_w a_s", word_to_vec_map)
     16     assert tuple(avg.shape) == tuple(word_to_vec_map['a'].shape),  "Check the shape of your avg array"
---> 17     assert np.allclose(avg, [1.25, 2.5]),  "Check that you are finding the 4 words"
     18     avg = target("love a a_nw c_w a_s", word_to_vec_map)
     19     assert np.allclose(avg, [1.25, 2.5]), "Divide by count, not len(words)"

AssertionError: Check that you are finding the 4 words

please help resolving the issue

Hi @Pulkit

The assertion is triggered in this test case because the values in the array ‘avg’ are not equal to [1.25, 2.5] elementwise within a tolerance level.

You need to check the code within the ‘for’ loop. Print statement is good for debugging. Put a print statement after the ‘if’ statement to see if the word is found in the word_to_vec_map, and a print statement before and after ‘avg’ is calculated.

thankyou sir resolved the issue