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
How does a typewriter involve math and science?
patriot [66]
You have a specific number of words typed a minute and you need to know the science involved in making it
8 0
2 years ago
Read 2 more answers
3. Touch screens are both input and output devices. Describe one application where a touch screen is used as an output device. (
defon

Answer:

Mobile phone

Explanation:

Hopefully this is right

7 0
3 years ago
Read 2 more answers
Do all light bulbs server a practical purpose?
Greeley [361]

Answer:

A light bulb produces light from electricity

6 0
3 years ago
In the early days of photography, cameras were limited to professional photographers because of the knowledge needed to work the
ki77a [65]
True  ------------------------------------------
8 0
3 years ago
Read 2 more answers
What is the definition of "potential energy"?
muminat
Well potential energy is energy that is in a object while its not moving so i would go your third option 
4 0
3 years ago
Read 2 more answers
Other questions:
  • In a case where electrical current leakage from the circuit occurs,
    7·2 answers
  • Which tab and group will allow the insertion of rows and columns in a worksheet?
    8·2 answers
  • Ok, so this isn't a tech question it's about a game, moomoo.io so don't hate on this if you don't know it, 40 points to whoever
    12·2 answers
  • Assign jsonData with the parsed value of the stringData variable. Then, assign 29 to the points property in jsonData and assign
    13·1 answer
  • Relation between training and occupation with examples in points . Plz tell fast<br> ​
    5·1 answer
  • Digital subscriber lines: are very-high-speed data lines typically leased from long-distance telephone companies. are assigned t
    5·1 answer
  • How to bypass a Lightspeed and Rocket Filter blocked website without being a admin and without downloading extensions? Must incl
    15·1 answer
  • Output each floating-point value with two digits after the decimal point, which can be achieved as follows:
    7·1 answer
  • 6. The following is a dump of a DATA chunk in hexadecimal format. 00000015 00000005 0003000A 00000000 48656C6C 6F000000 a. Is th
    7·1 answer
  • In “Plugged In,” the author’s purpose is to persuade. Which of the following quotes from the text shows that the author’s purpos
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!