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

is melting,freezing,vaporization,and condensation gain or loss in movement of particles?
what are the four requirements for life?
If f(x) = x² – 3, where x is an integer, which of the following could be a value of f(x)? a. 6 b. 0 c. -6 It would be great if you could add a few words of expl
the energy is water but i wanf to know how does it affect the enviorment?
what is the correct way to write this sentance ?The name of the ride—Killer Bees—as well as the graphicportrayal of bees attacking people and pets illustrated o
rounding - 8.238; tenths 3.666; tenths 4.47; ones 10.86; ones 3.299; hundredths 20.687; hundredths 2.3654; thousandths 69.0678; thousandths 5.58214; hund
Calculate the discriminant.x2 – 2x + 4 = 0      20      12    –12      0
I do not get how to do Simpliflyng Radicals.
1. Can someone help me with this? :) Which object is made of frozen gas, ice, and dust that orbits in the outermost reaches of the solar system?1) planet2) moon
brilliant light displays that occur in the Ionosphere are called the?