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

Which of these is an example of a monetary incentive? A Having fun walking a dog B. Making friends on a sports team C. learning a new skill by studyi
0.142857143 as a fraction simplified
Carlos was happy when he found that he had $50. Then he remembered that he owed a friend $60. How much money does Carlos actually have?
if a girl worked for 5 hours a day and gets payed $9 dollars an hour how many hours does she have to work to get 2,000 dollars
Da Shari wants to rearrange the four sweaters, two coats, and five jackets that are in her closet. If she puts a sweater first and a jacket last, how many difer
If it took Mark 45 minutes to get to work and 35 minutes to get home, how long did he spend travelling to and from work?
what two changes occurred after Thomas Jefferson took office as president of the United States in 1801
can u show me how to solve this problem 0.11 times 0.91
PLS I DONT HAVE LONG Please explain the concept and give at least one real world example that demonstrates the concept of Investigating Quadratics. Thank you
Which item is an example of a secondary source