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

help .me with those two questions
Of the elements Fe, Hg, U, Te, and Y, which is considered a Group A element?
How did new weapons and technology change the course of war during World War I?
Ordered pairs for y=1/2x-3
in the opening of the unseen text of dracula, how has the writer structured the text to interest you as a reader? in detail plz
Where in the dialogue should there be a paragraph break or paragraph breaks? “Look at those clouds,” Jeff commented. “It’s about to rain.” “I agree. The sky is
How did the magna carta, english bill of rights, mayflower compact , and thomas paine common sense influence colonist views of government ?
Does anyone know (3/4) to the power of -2?
Biotic factors cannot live without abiotic factors. True False
Which of these is a simplified form of the equation 7y + 7 = 9 + 2y + 2y? 3y = 2 7y = 6 11y = 16 4y = 16