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

A gardener weeds 2/3 of a flower bed in 6 min. How much of the flower bed did the gardener weed in 1 min?
Is the product of 1/2 x 1/2, larger, smaller or the same size as 1/2?
What is 1/3 of 18 Fraction problems
Theodore Roosevelt's first major trust-busting victory resulted from a suit brought against A. the Northern Securities Company. B. Standard Oil. C. the American
When evaluating promotional claims, it is important to __________. a. do your own research c. determine if there are other possible solutions b. ask if it make
Long periods of unusually low precipitation are called?
Micah is thinking of a two digit number. it is a multiple of 6 and 12. is a factor of 108. the sum of its digits is 9. what number is Micah thinking of
find the zeros of the function f(x)=2x^2-7x-30
chad buys peanuts in 2 pound bags. he repackage them into bags that hold 5/6 pounds pound of peanuts. how many 2 pound bags of peanuts should chad buy so that h
Which was not an issue that divided the delegates to the Constitutional Convention? A. how to count slaves for representation B. the continuation of the slave t