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
What was bill gates first operating system he created?
vagabundo [1.1K]
Microsoft windows was his first

3 0
3 years ago
Read the citation example, and then use the drop-down menus to identify each part.
Lemur [1.5K]

Answer:

im notur e

Explanation:

5 0
3 years ago
Read 2 more answers
The best way to ensure the accuracy and safety of your accounts is to:
Gekata [30.6K]
Use symbols and a different password for each one

6 0
3 years ago
What is the significance of the Abstract section of a research paper? A. It contains important information such as the author, c
Bond [772]

Answer: A

Explanation:

7 0
3 years ago
A network technician is asked to redesign an Ethernet network before some new monitoring software is added to each workstation o
mina [271]

Answer: network administrator

Explanation:

8 0
3 years ago
Other questions:
  • A network engineer arrives at work and discovers that many users are having problems when attempting to connect to the company n
    9·2 answers
  • Which wireless technology has a typical transfer rate of 1 Mbps to 3 Mbps at distances up to about 10 meters?
    7·1 answer
  • What is one method that can be used to open the Microsoft Word application?
    8·1 answer
  • To create a chart, you need to select at least
    8·1 answer
  • . How is using 0 / 1 or true / false in specifying digital an abstraction?
    11·1 answer
  • The executive ________ is the person ultimately responsible to their company for the project's success.
    13·1 answer
  • BRAINLEST AND 20 POINTS! Most GUls provide all of the following except
    6·2 answers
  • Define Agricultural Era
    14·2 answers
  • In java I need help on this specific code for this lab.
    5·1 answer
  • Write A Code In Python
    8·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!