xclorenzo97 xclorenzo97
  • 12-06-2021
  • Computers and Technology
contestada

How do you find the average length of words in a sentence with Python?

Respuesta :

yme304002
yme304002 yme304002
  • 12-06-2021

Answer:

split() wordCount = len(words) # start with zero characters ch = 0 for word in words: # add up characters ch += len(word) avg = ch / wordCount if avg == 1: print "In the sentence ", s , ", the average word length is", avg, "letter." else: print "In the sentence ", s , ", the average word length is", avg, "letters.

Answer Link

Otras preguntas

Factor y 2 + 10z - 10y - yz.
How much money should you save in case you have an emergency? Eight months of living expenses Six months of living expenses Twelve months of living expens
What is the best first step if your plan is to find the exact value of cos 75°using the cosine angle sum identity?
Use the normal distribution of fish lengths for which the mean is 11 inches and the standard deviation is 2 inches. assume the variable x is normally distribute
a point labeled zero is called?
Choose the best science design to test the question "which soil type results in the highest yield of tomatoes: clay soil or sandy soil?"
The action in which a router divides and forwards incoming or outbound message traffic to multiple links is known as
How is 250 less than2500
Flashing red and yellow lights control some intersections during times when there is_________traffic flow.
Hassem and his family cut an apple pie into 5 equal slices and a blueberry pie into 10 equal slices. They ate  of the apple pie. If they ate the same fraction o