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

Prove the identity: cos(3x) + cos(x) = 2cos(2x)cos(x) I'm almost done with my homework, just got stuck on this one.
How do I write 4.76325 as a fraction?
Susan invests twice as much money at 7.5% as she does at 6%. If her total interest after a year is $840 how much does she have invested at each rate?
How long does interphase last?
What is an analogy for democracy?
Write 75 as the product of its prime factors. (2 marks)
Which of the following differs when comparing the deep ocean to the intertidal zone? PLEASE HELP!!! •need for energy •salinity •the amount of sunlight •relianc
Mr Jones has 20,000 to invest. He invests part at 6% and part at 7%, if hr earns 1,280 in interest after 1 year, how much did he invest at each rate.
what's bigger 60% of 90 or half of 100?
What does a journal written by frontier settlers most likely tell you about Manifest Destiny?