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

egener’s theory of _____ says that land masses move slowly.
what is the molarity of a solution containing 7.0 moles of solute in 569 mL of solution??
List 6 forms of renewable energy and compare the advantages and disadvantages of each
Which headline suggests a neutral point of view on the subject matter? A. Congress Passes New Environmental Legislation B. Congressional Liberals Push Ad
What are some of the ways that parasites have adapted to transmission between hosts,
The altitude to the hypotenuse of a right triangle has a length of 12. what could be the lengths of the two segments of the hypotenuse ?
What kind of vitamins should i take on the depo shot?
Is this a valid statement? "The French Revolution was the manifestation of Enlightenment ideals."
Why wouldn’t the deputy allow Noah in to visit his father?
Which president built a 40 nation coalation under the united states to force iraq to withdraw after it invaded kuwait in 1990?