1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Alik [6]
3 years ago
6

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 this word (any score of 2.0 or higher can be considered
Computers and Technology
1 answer:
Hatshy [7]3 years ago
5 0

Answer:

import numpy as np

word = input("Enter a word: ")

acc = []

with open("Downloads/record-collection.txt", "r") as file:

   lines = file.readlines()

   for line in lines:

       if word in line:

           line = line.strip()

           acc.append(int(line[0]))

   if np.mean(acc) >= 2:

       print(f"The word {word} is a positive word")

       print(f"{word} appeared {len(acc)} times")

       print(f"the review of the word {word} is {round(np.mean(acc), 2)}")

   else:

       print(f"the word {word} is a negative word with review\

{round(np.mean(acc), 2)}")

Explanation:

The python program gets the text from the review file, using the user input word to get the definition of reviews based on the word, whether positive or negative.

The program uses the 'with' keyword to open the file and created the acc variable to hold the reviews gotten. The mean of the acc is calculated with the numpy mean method and if the mean is equal to or greater than 2 it is a positive word, else negative.

You might be interested in
The greater the profit motive in an economic system , the greater the likelihood of a.Innovation b.Equity c.Security d.Governmen
xxMikexx [17]

Answer:

d. Government controlling the factors of production.

Explanation:

Businesses exist to make profit. There is requirement to provide value for money to the customers in order for a business to achieve success. When a business fails to provide good customer service and exists only to make profits they might fail. In such situation government intervenes to stop the monopoly and save the consumers from the mercy of business.

3 0
3 years ago
What kind of device should you install if you need the device to perform network address translation, facilitate access to the I
just olya [345]
The Correct Answer would Be A Router.
8 0
3 years ago
To be eligible for the leadership training program offered by the office, a student must have at least 2 years of post-secondary
erica [24]

Answer:

The formula for the given problem is:

=IF(OR(D2>=2,G2>"Yes"), "Yes", "No")

Explanation:

Please see attachment for step by step guide

7 0
4 years ago
Olivia is an amputee who wears a prosthetic right hand. Which technology would most help her operate a computer?
satela [25.4K]
Nerve interface is technology that allows amputees to use thoughts to move prosthetics
3 0
2 years ago
Which of these has led to the evolution of mobile marketing?
Nana76 [90]
D. using cell phones in a work place. when cell phones came out with apps and games people started paying more attention to the social media apps and their games then their own job, hope this helps :)
5 0
3 years ago
Other questions:
  • I'm curious why I would need to know this on a school learning site.
    12·1 answer
  • Explain working principle of computer?​
    13·1 answer
  • ________ is an open-source program supported by the Apache Foundation that manages thousands of computers and implements MapRedu
    5·1 answer
  • Select all the correct answers. Which two statements are true about an OS? translates the user's instructions into binary to get
    10·1 answer
  • ASAP NEED HELP ASAP NEED HELP ASAP NEED HELP ASAP NEED HELP ASAP NEED HELP ASAP NEED HELP ASAP NEED HELP ASAP NEED HELP​
    6·2 answers
  • ---------- is a flat fish which swims using its huge side fins.​
    7·1 answer
  • What is the term for unsolicited Email​
    15·1 answer
  • If you are going to analyze and interpret data, you need to do all of the following execept blank.
    12·1 answer
  • What does GEOSYNCHRONICE SATELLITE use for?​
    7·2 answers
  • Explain how power surges can affect computers and how this problem can be minimised or removed<br>​
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!