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

In 1778, the United States and France signed the Treaty of Alliance, in which both countries agreed to assist the other in case of an attack by Great Britain. I
In addition to the financial reward it already offers for the birth of new babies, what other steps could the government of Singapore take to guarantee its futu
Supply the missing reason(s) for the given proof
A difference between Commodore Perry's "Black Ships" and the Great White Fleet was that the "Black Ships" :
Explain the four quantum numbers
Activists in the counterculture movement were successful at doing which of the following? weakening the Republican Party turning public opinion against the Viet
Can some one please help me?
How is the 2 in the number 582 similar to and different from the 2 in the number 528
Find the X and Y intercepts (-4,-3) (1,6
Lyndon Johnson signed the Civil Rights Act of 1964. Which groups were affected by this piece of legislation? all racial minorities just women only African Ameri