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
Artist 52 [7]
2 years ago
5

If you have downloaded this book's source code from the companion Web site, you will find a file named text.txt in the Chapter 1

2 folder. (The companion Web site is at www.pearsonhighered/gaddis.) The text that is in the file is stored as on sen- tence per line. Write a program that reads the file's contents and calculates the average of words per sentence.
Computers and Technology
1 answer:
Lubov Fominskaja [6]2 years ago
6 0

Answer:

Explanation:

The following python code loops through each line within a file called text.txt and counts all the words, then it divides this count by the number of sentences in the text file. Finally, output the average number of words per sentence.

f = open("text.txt", "r")

all_words = 0

sentences = 0

for x in f:

   list = x.split(' ')

   all_words += len(list)

   sentences += 1

average = all_words / sentences

print("There are an average of " + str(average.__round__()) + " words in each sentence.")

You might be interested in
Which of the following is the result of a query?
IgorLugansk [536]
I think the answer is A
6 0
2 years ago
In this exercise you will debug the code which has been provided in the starter file. The code is intended to do the following:
abruzzese [7]

Answer:

The corrected code is as follows:

import java.util.Scanner;

public class U2_L4_Activity_Two{

public static void main(String[] args){

Scanner scan = new Scanner(System.in);

String str1 = scan.nextLine();

String str2 = str1;

str1 = str1.toUpperCase();

System.out.println(str1);

System.out.println(str2);

}

}

Explanation:

This corrects the scanner object

Scanner scan = new Scanner(System.in);

This line is correct

String str1 = scan.nextLine();

This copies str1 to str2

String str2 = str1;

This converts str1 to upper case

str1 = str1.toUpperCase();

This prints str1

System.out.println(str1);

This prints str2

System.out.println(str2);

8 0
3 years ago
Need help with this please and thanks
Kryger [21]

Answer:

<h3>Connector names are written below Picture vise:</h3>
  • USB-C
  • USB 2.0
  • Micro USB
<h3 />

Explanation:

Following is the brie Illustration of the terms used:

  • USB-C:

              It is the newest connector in the market with the             reversible/symmetrical design. It can be adapted to work with the legacy connectors such as USB-A, USB-B, USB-C and Micro USB.

  • USB 2.0:

              It is used mostly in the connections of electronic devices such as printers and smartphones. It has A to B connectors as well as micro USB connectors and mini USB connectors.

  • Micro USB:

              It is used for the connection o compact devices such as smartphone and mp3 players. They are further grouped into three categories: Micro A, Micro B and micro USB 3.

<h3>I hope it will help you!</h3>
7 0
3 years ago
Intellectual property rights are exclusive rights that help protect both the created and the creation. IPR offers exclusively wh
dedylja [7]
IPR offers ownership of the intellectual property. The owner of the property has the right to a monetary gain from those who wish to use it.
8 0
2 years ago
Read 2 more answers
What is peopleware?<br>need help​
Oksana_A [137]

Answer:

Peopleware is a term used to refer to one of the three core aspects of computer technology, the other two being hardware and software.

3 0
2 years ago
Other questions:
  • What dose it need For a device to be considered a kind of computer
    14·2 answers
  • An idea concerning what will happen in the future. (Crossword)
    9·1 answer
  • What describes the basic transaction data such as its date, purpose, and amount and includes cash receipts, canceled checks, inv
    13·1 answer
  • The ash and dust from a volcanic eruption can cause a ______ change in the environment.
    8·1 answer
  • who will follow me on tiktok and like all my videos? if you do ill give branlist and give u a shoutout and you can enter my big
    15·1 answer
  • The security administrator for Corp.com wants to provide wireless access for employees as well as guests. Multiple wireless acce
    11·1 answer
  • What is the largest place value in a 12 bit binary number?
    10·1 answer
  • Do you think lossy compression formats will be popular in 20 years? Why or why not?
    10·1 answer
  • Choose the true statement below. (html)
    5·1 answer
  • Which of the following is NOT a long-term storage device?
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!