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

What are the two largest ethnic groups in the united states today?
Who was the so-called new middle-class? What was the role of expertise and organization in this new professionalism?
the student council president wants to find out the opinion of the students on the issue of school lunch options. The president sends out a survey to a random
what are some fun facts on animal and plant cells.
what is the solution to 1/3(s-2)=s+4
A six−sided die, with sides numbered 1,2, 3,4,5, and 6, is tossed. What is the probability of tossing a number less than three?
What is a scale on a map?
kilo-  -  1,000deka-  -  10How much larger is a kilo- than a deka-?
what is a post hoc fallacy?
What Was Jackson’s perspective on the McCulloch v. Maryland Supreme Court Case