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 length of a rectangle is 4 more than 3 times the width. If the perimeter of the rectangle is 56, what is the length of the rectangle
I need help Letters B-D Please and Thank you.I don't get how to put the numbers in.
what is 0.36 squared in fraction form
Andrea writes a down a number , k. I write down a number that is 4 less than 5 times Andrea's number. If the sum of our numbers is 14, find the two numbers.
PLEASE ANSWER RIGHT NOW LIKE RN PLEASE
uadrilateral ABCD has coordinates A (3, 1), B (4, 4), C (7, 5), D (6, 2). Quadrilateral ABCD is a
Paid wages of $1,000 for the current period (example). Borrowed $5,000 cash from local bank using a short-term note. Purchased $2,000 of equipment on credit. Ea
I need help with the two in the picture please.
The number of enslaved africans in southern colonies increased dramatically in the late 1600s, mostly to satisfy the need for
what is the final volume of a gas with an initial volume of 75 mL if the pressure decreases from 300 kPa to 200kPa? A. 100 mL B. 50mL C. 75.5mL D. 112.5 mL