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

Which character could i compare Barack Obama to? In terms of the play "the crucible"
I need help with this math question 167/100 = blank/100
How do u break down 7x86 for the distributive property of multiplication
What are convection currents
Which shapes have at least one pair of parallel sides?
a square piece of paper is folded in half to form a rectangle. this rectangle has a perimeter of 24 cm. find the area of the original square in sq cm
Evaluate: |18| A:1/18 B:-1/-18 C:-18 D18
220 is 95.3% of what number?
numbers expressed using exponents are called
One of the most loved Christmas books is A Christmas Carol. Who wrote it? A) Mark Twain B) Charles Dickens C) Hans Christian Andersen D) Thomas M. Sawyer