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

Who initiated the phrase "manifest destiny"? a. John Tyler b. John L. O'Sullivan c. James K. Polk d. William Henry Harrison
Perform the indicated operation. 3.26 + (-4) -0.74 -0.64 0.74 3.22
Every file on a storage device has a _______. (a.) name (b.) size (c.)both of the above (d.) none of the above
An intervening opportunity is an example of a A. push factor B. pull factor C. low standard of living D. destination for periodic migration
An equilateral triangle has a side length of 10 inches. Find the length of the triangle's altitude
A It removed the Tsar from power. B It ended the war. C It instituted a communist government D It gave ramped up support for the war.
Which of the following mining types can be used to obtain uranium? b. underground c. solution
Which mineral has the same hardness as a fingernail? a. Diamond c. Fluorite b. Topaz d. Gypsum
How did Beadle and Tatum's experiments provide a chemical explanation for dominance and recessiveness?
HELP PLEASE! The LaSalle High School senior class raised funds for an end of the year cruise getaway. The city gave them a special package for the port fees and