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
_____ refers to unsolicited commercial emails, usually sent to a large number of people with little regard to the users interest
frozen [14]
Spam refers to large unsolicited email irregardless of the recipients views on the matter
5 0
3 years ago
What is the process in which a server is partitioned into smaller components virtually
lilavasa [31]

The answer to your question is,

Server virtualization

-Mabel <3

3 0
3 years ago
Who create and developed castlevania?
Ray Of Light [21]
The game was made by Nintendo. 
Developers: Koji Igarashi<span> </span>Hideo Kojima<span> </span>Michiru Yamane<span> </span><span>Yuzo Koshiro. </span>
6 0
3 years ago
A(n) _____ evaluates a specified data set and returns certain fields from that data set as instructed.
elena55 [62]

The correct answer is Query

5 0
3 years ago
Read 2 more answers
Data stored in computer systems has a high value because there is a great deal of time and effort that goes into creating an ana
Andrew [12]

Answer:

Data often has intrinsic value.

Explanation:

Data stored in computer systems has a high value because there is a great deal of time and effort that goes into creating an analyzing it and data often has intrinsic value.

5 0
3 years ago
Other questions:
  • Google Slides saves your work to Google Drive. PowerPoint has the option to save to OneDrive. Both of these solutions are in the
    9·1 answer
  • CNG and gasoline-powered vehicles use the same internal combustion engine, but different fuel types. A) True B) False
    8·2 answers
  • Which of the following is NOT essential for individuals to have to build their own web page?
    9·1 answer
  • What is the cell reference for the cell located in the second column and fifth row of a worksheet?
    9·1 answer
  • Between Handshake protocol, change cipher suite, alert and appplication data protocols, the first one to use is:
    13·1 answer
  • Which of the following is productivity strategy for collaboration?
    6·1 answer
  • Lucy has to move data from column A to column N in a worksheet. Which keys should she select to move data in the same worksheet?
    9·2 answers
  • What is the difference between "What I ought to do?" and "What kind of person should I be"?
    12·1 answer
  • How to execute python code in command prompt *window*?
    5·1 answer
  • Vẽ sơ đồ DFD cho của hàng bán điện thoại ( Môn phân tích và thiết kế hệ thống thông tin)
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!