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

The vertex of the parabola is at (-2,1) Which of the following could be its equation.
The four essential aspects of successful training are A. food, praise, stimulation, and exercise. B. instinct, conditioning, education, and observat
What was the domino theory?
When Using Fraction Strips, How Do You Know That Two Fractions Are Not Equivalent?
How do you work out 6(3k+5) = 39? Please help! :)
What is the prime factorization of 85
Travis earned 92 bonus points. Zoe earned b more bonus points than Travis. Write an expression that shows how many bonus points Zoe earned. Type an asterisk ( *
help mee pleaseeeeeeeeeee
How many stars are there
Give three examples of how new inventions and produces have changed medicine over the years.