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

Find the slope of a line with x-intercept 5 and y-intercept -3.
how are yall day going?
The perimeter of a rectangular skating rink is 530 feet. If the length is 5 feet more than 3 times the width, what are the dimensions? Please show work, I will
What is the BEST revision you can make to create a strong argument? O Order your ideas in a more logical way. Include every reason you can consider. O Compare y
find the sum 34+(-96)
What did the princess choose? The Lady or the Tiger,
Why do you think that the South would have been looking to recreate slavery economically after the Civil War? Why do you think would the Northern states, who ha
From a distance, they both look like seals, but once you get up close you can actually see the difference. Seals and sea lions are both fish-loving mammals. Mor
please help help help help
If point (1,0) is on the line whose equation is y=2x+b, what is the value of b?