Can someone give me a a hint on how to solve this problem. I am stuck
No problem, I’ve searched the forum for you:
Thanks a lot.i’ve submitted my first assignment
Hi … i stuck at this point …i write a code but it is not working properly …giving unexpected value
number_of_happy_tweets = 0
for happy_words in sample_tweet:
if word in sample_tweet:
can anyone help here?
What is the question?
The same questions …
Q13: Determine the number of tweets in the dataset that can be classified as happy.
For tweet in tweets:
For word in happy_tweet:
If word in tweet:
What I did was to create a for loop for the main tweet.
Same thing is done for the happy_tweet.
create an if conditional statement which states:
If a word from the happy_tweet is found in the main tweet add one to the number_of_happy_tweet which is assigned the value of zero.
still …didn’t abel to get that…can you explain more briefly?
We are looping through all the tweets one by one…
Now for the nth tweet we are looping through all the words…
Next we are checking if the mth word is present in the nth tweet or not…
If it is present then we increasing number_of_happy_tweets by 1 and breaking out of the loop so that other words would not get checked otherwise it will give wrong results (but for this particular question you don’t need to use break as the tweets are given in such a way that only one happy or sad word is present in the tweet).
Hope you will understand…
thank you so much @vinaypratapsingh609 i perfectly understood it.
i also did the same…but I m also thinking of using the split function to split each tweet then check with the given word (logical) and sum those logical =. if greater than equal to one; I count as one otherwise 0. i haven’t tried this out…is the logic good?