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

Los chicos deben  _____er al profesor como el Sr.Rios whats the missing blank
what is 28.09 rounded to the nearest tenthvis
Mrs. Jennings had a 5/7 gallon of paint. She gave 1/7 gallon each to some students. How many students received paint if Mrs. Jennings gave away all the paint?
What does your text mean when it says that the Constitution, "...elevated the ideals of the Revolution even while setting boundaries to them."?
what happened to the loyalists property after the revolutionary war was over
AFTER EVERY NINTH VISIT TO A RESTAURANT YOU RECEIVE A FREE BEVERAGE . AFTER VERY TWELFTH VISIT YOU RECEIVE A FREE APPETIZER . IF YOU VISIT THE RESTAURANT 100 TI
What is the difference between federalism and separation of powers
Basic. Is to luxurious as common is to
plrase help a little stuck here
how many atoms of hydrogen are present in the reactants and in the products? 6CO2 + 6H2O → C6H12O6 + 6O2