sydneyree1954 sydneyree1954
  • 04-07-2019
  • Computers and Technology
contestada

Write a function def countWords(stri ng) that returns a count of all words in the string string. Words are separated by spac For example, countWords ("Mary had a little lamb") should return 5.

Respuesta :

SerenaBochenek SerenaBochenek
  • 14-07-2019

Answer:

def w_count(s):

   return(len(s.split()))

st=input('Enter a string:')    

print("Number of words in given string=",w_count(st))

Explanation:

Ver imagen SerenaBochenek
Ver imagen SerenaBochenek
Answer Link

Otras preguntas

how does benjamin franklin view the Iroquois League?
Jenny spent $270 on pairs of pants. Dress pants cost $90 and jeans cost $30. If she bought a total of 5 pairs of pants, then how many of each kind did she buy?
Discuss how the respiratory and circulatory systems work together to deliver oxygen to individual cells. Make sure to include what is brought from the lungs/to
Please show me how to do this step by step, I’m confused…
What do we learn about the two main families from the Prince?
How does the formation of nucleic acid polymers differ from the formation of polysaccharides?.
At the end of “The Chrysanthemums,” Elisa whispers, “That’s a bright direction, There’s a glowing there.” Write an essay explaining what you think Elisa means b
chip and dale steal 25% of Donald ducks apples how many apples do they steal if he gathered 300 apples
Mr. Lewis’s paycheck is $506.14. After he spends $48.69 of the money on groceries, how much will he have left?
Marisol is practicing the preterite tense. She wrote the following sentence… Ayer Carlos y Juan fuimos al mercado. Did she use the correct form of ir in the pre