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

Can you show me how to solve 33=-2a+7
Along with the piano and the voice, the violin is one of the instruments with the most extensive concert repertoire. (A) True (B) False
Identify and describe common traits that make up a culture. Use examples from your own culture and describe why these are important to your culture.
a spinner has 3 equal sections labeled red, purple ,and yellow how many times would you expect to land on red if you doin it 24 times
Larson has a score of 89 for each of his first three science quizzes. The score on his fourth quiz is a 92. What score does he need on the fifth quiz to have an
Anybody know the answer?
Why are me and mrs numbers so happy
Explain second stanza of the poem "If" by Rudyard Kipling
imperfect form ¿Cómo ____________ (SER) tú de niño?
Bob has in his pocket a number of pennies, five times as many nickles as pennies, and 6 more quarters than pennies. the coins amount to a value of $2.52. find t