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 is 4/5÷3/4 in simplest form
math Simplify the expression ​
Data Analysis Aquatic Organism pH Range for Life Clam 4.5 - 5.0 Snail 5.0 - 9.0 Bass 5.5 - 9.0 Crayfish 5.5 - 8.5 Mayfly 5.5 - 9.0 Salamander 6.0 - 8.0 Trout 6.
As a result of the revolutionary war women had to
If m b.286 c. 74 d. 37 e.143
Just prior to world war i, the nations of europe believed that the balance of power could best be maintained by
Which perspective did raymond cattell use as a basis for his personality measure known as the 16pf test?
How can the relationship between vultures and cheetahs be described? A) The Activities of Cheetahs are harmful to vultures B) Vultures benefit from the activiti
which lists all of the y- intercepts of the graphed function?
Which of the following is least likely to kill the organism it feeds on? A) herbivore B) predator C) seed eater D) carnivore E) parasite