C4_W1_Assignment UNQ_C8 wrong hint

The hint to use get() method for looking up the value of the token in sys_coynter and ref_counter dictionaries resulted in the unit tests failing (1 pass, 3 failed).

But instead using sys_counter[token] and ref_counter[token] made all unit tests pass! Weird!!

1 Like

Hi @rameshvasu

dictionary.get(key, no_key_value)

The Python dictionary .get() method returns the value of the item with the specified key and if you optionally specify “no_key_value” that will be returned.

So you should use it the right way, for example:
sys_counter.get(token, 0)
and the test will not fail.

Good luck!


Can you please tell me how can I calculate precision and recall in this case? I am getting 3 pass and 1 fail. I did the following.

# get the precision
precision = overlap/len(ref_counter)

# get the recall
recall = overlap/len(sys_counter)

I am stuck and no one is responding to my posts to help me out.


Hi @vrathi

Check this answer to your same question.