C3W1 get_word_frequency function

Could you help me with my get_word_frequency function?

{moderator edit - solution code removed}

I keep getting this output which is obviously wrong:
{‘going’: {‘spam’: 1, ‘ham’: 0}, ‘river’: {‘spam’: 1, ‘ham’: 2}, ‘like’: {‘spam’: 1, ‘ham’: 0}, ‘love’: {‘spam’: 0, ‘ham’: 1}, ‘deep’: {‘spam’: 0, ‘ham’: 1}, ‘hate’: {‘spam’: 0, ‘ham’: 1}}

Please do not post your code on the forum. That is not allowed by the Code of Conduct.

1 Like

Hi, David.

Please have a look at what they said in the section titled:

4.1.1 Handling 0 in the Product

and consider the implications for your code. My interpretation is that they say just to initialize both counts to 1 and go from there. That’s how I did it and my code passes both the internal tests and the grader.

And looking at the code again, note that they are really trying their best to help you out here: they also gave you a comment in the template code that makes explicit the net effect of that section of the instructions.

1 Like

Sorry, it won’t happen again.
How do I ask for help the next time that I have a problem?

You can post an image of your error messages.

1 Like

Noted