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.")
Answer:
a variable of type "double" is more suitable for finding average because average could be any number with decimal places. we can't use a variable of type "integer" because it will omit the value after the decimal and will not produce satisfactory results.
Explanation:
an example of C++ code is given to find the average of two numbers a and b
#include <iostream>;
using namespace std;
int main() {
double a = 2.334;
double b = 34;
double average = (a + b) / 2;
cout << average;
return 0;
}
<span>She wants to work in natural resources.</span>
<span>cell spacing is the answer</span>