C1_W2_Assignment - count_tweets

I am having an issue getting my output identical to the expected output:

My output: {((‘happi’,), 1): 1, ((‘trick’,), 0): 1, ((‘sad’,), 0): 1, ((‘tire’,), 0): 2}
Expected output: {(‘happi’, 1): 1, (‘trick’, 0): 1, (‘sad’, 0): 1, (‘tire’, 0): 2}

As a result I assume my test function 3 tests failed. I am not sure what to look for, I have changed different variations of the loop but with no luck. Any insight will be appreciated:

Here is my for y, tweet in zip(ys, tweets):
Define the key, which is the word and label tuple
processed_tweet = tuple(process_tweet(tweet))
pair = (processed_tweet, y)

Hi @Neamen_Tewahade

As you can see (‘happi’,), 1 is not the same thing as (‘happi’, 1). That is your mistake.

You have to have two loops - one (outer) to loop over each *tweet), the other one (inner) to loop over each word in a tweet. And the pair you construct is just (word, y).


Thanks for that! I appreciate it. That was one of the blockers. Best!