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

A planet in our solar system is located far from the sun describe the size and composition of the planet
How do you simplify 18/35
What religion got caught in the middle of wars between Catholicism and Islam in Spain?
How can cultural experiences and perspectives be conveyed through memorable narratives?
Palabras Parecidas a lluvia
what is the equation with a slope of 0 that contains the points (8,-9)
the number of birds that Vikram saw on a nature walk is 1 less than 4/5 the number of birds that Shaya saw. Shay saw a total of 10 birds. how many birds did vik
martian periodic table
The sum of three consecutive integers is 42. Let x be the middle of the three integers.
What is 949 rounded to the nearest ten and hundred