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

I need help worksheet
How could you increase the kinetic energy of a apple?
I have a question for english here it is Thomas went to school, but he had not studied. Which shows the best way to change this compound sentence into two simpl
Suppose, for each triangle in the diagram, the measurements that are labeled are known, while the other measurements are unknown. In which triangle can you dire
When Justice Black makes reference to Cox v. Louisiana in the dissenting opinion for Tinker v. Des Moines, which kind of reasoning is he using to support his ar
Simplify 8 · 9 − 2 · 5
How do i make a real world slope equation?
Why does Dante refer to Minos and other allusions from mythology? How does it add to Inferno? Your answer should be at least one hundred words.
the sum of two numbers is 31. The product of the two numbers is 150. What are the numbers?
Why we're the founders of the Plymouth colony called pilgrims