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

Will a mutation in a human skin cell be passed on to persons off spring
According to dutch management professor geert hofstede, culture is referred to as the:
Oceanside bike rental shop charges 17 dollars plus 9 dollars an hours for renting a bike. Tom paid 53 dollars to rent a bike. How many hours did he pay to have
What did dr smartz say to the guy who had been attacked by a vicious eight foot tall cockroach?
What is the width of a rectangle with sn area of 300 square feet if it's length is 1 foot? if it's length is 2 feet?if it's length is 3 feet?
What energy transfer is occurring when a plant uses energy from the sun to make sugar in fruit? Radiant energy is converted to nuclear energy. Radiant energy
A machine has a mechanical advantage of 5. What force should be applied to the machine to make it apply 3000 N to an object?
Why are silver, lead, and mercury so special? (why do they always precipitate out and never dissolve) PLEASE BE DETAILED BUT SIMPLE
How are the hyperglycemia and lipidemia of insulin linked?
What can be inferred about Rev. Paris’s motives for covering up the “sin”? In other words, of what is he most afraid of?