question archive Write a program that asks the user for a word

Write a program that asks the user for a word

Subject:Computer SciencePrice: Bought3

Write a program that asks the user for a word. Next, open up the movie_reviews.txt file and examine every review one at a time. If a review contains the desired word you should make a note of the review score in an accumulator variable. Finally, produce some output that tells your user how that word was used across all reviews as well as the classification for htis word (any score of 2.0 or higher can be considered "positive" and any score less than 2.0 can be considered "negative). For example:

Enter a word to test: happy
'happy' appears 17 times
The average score for reviews containing the word 'happy' is 2.588235294117647
This is a positive word
Enter a word to test: awful
'awful' appears 23 times
The average score for reviews containing the word 'awful' is 1.0869565217391304
This is a negative word
Enter a word to test: pikachu
'pikachu' appears 0 times
There is no average score for reviews containing the word 'pikachu'
Cannot determine if this word is positive or negative

pur-new-sol

Purchase A New Answer

Custom new solution created by our subject matter experts

GET A QUOTE