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 cells were chloroplast present in? What did they look like in the various cells?
The lowest elevation in the world is in the Dead Sea at 413 feet below sea level. The highest elevation in the world is Mount Everest at 29,035 feet above sea l
In an effort to determine where the company can cut spending, Larry creates a pie chart to show how the company spends money on non-required items. Out of the $
what two object are the same distance from sea level? explain how you know
Who was the Massachusetts Bay colony established in new England by?
a car traveled 180 kilometers in 3 hours. which statement best describes the distance traveled by the car per hour? a) the car traveled 1/3 kilometer per hour.
Find the missing number in the pattern. 1, 12, 23, _____, 45, 56 a. 31 b. 34 c. 37 d. 42
Colonial governments practiced the idea of rule of law. Which of the following was one of the ways that the idea of the rule of law was applied in the colonies?
Ford motor company sells the fusion ses for $24,400. the fusion hybrid sells for $29,975. what is the percentage increase in price for the hybrid over the fusio
If a liter of water is cooled from 50 to 30 what happens to its volume