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]
3 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]3 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
Coordinate with
Lunna [17]

Answer:

First blank: producer

Second blank: Hairdressers

5 0
3 years ago
To create a formula in ___ you would first click in one of the cells. A.word b.excel c.facebook d.powerpoint
guajiro [1.7K]
The correct anwser is excel 
7 0
3 years ago
Which of the following describes the term "false information?"
pav-90 [236]
Inaccurate and misleading
3 0
3 years ago
Which of the following is the term for software that automatically displays or downloads unwanted offers?
slega [8]
Adware. Adware displays ads and popups. The other options are completely different from each other
5 0
3 years ago
What is a risk or an effect of software piracy?
Butoxors [25]
Piracy is a term used to describe the practice of obtaining or using software in a manner that is illegal or not in keeping with the terms under which the software was distributed. This can range from purchasing or copying the software, to using the software without a license, to selling, renting, or otherwise distributing it without authorization.<span>The Business Software Alliance estimated the losses to software companies in 2005 as a result of piracy at over $30 billion.</span>
5 0
3 years ago
Read 2 more answers
Other questions:
  • (Drag each tile to the correct box)While surfing online, Patricia first checks her email and reads the latest messages. She then
    8·1 answer
  • Which of these browsers was the first widely adopted?
    12·1 answer
  • Infrared, a wireless connection used in the past prior to bluetooth, was limited because it ________.
    10·1 answer
  • Privacy Group of answer choices must be respected if we are to function as complete, self-governing agents is an absolute value
    5·1 answer
  • What is the missing line of code?
    7·1 answer
  • A user purchased a new smart home device with embedded software and connected the device to a home network. The user then regist
    5·1 answer
  • 75+ (43-54)<br> -12<br> 12<br> 41
    12·2 answers
  • 4.2 lesson practice last one plzs help
    5·2 answers
  • 3. Windows that are viewed as Web pages have<br> sections. **
    9·2 answers
  • What refers to a collection of small sections of code that are stored together to solve many everyday programs?
    11·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!