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

I need the value of x. Show all your work or no points. Please explain thoroughly.
Which was a result of the US occupation of Japan after World War II
Julia, an economics professor, is giving a presentation on her research. What presentation delivery method should Julia use if she wants to broadcast her lectur
What effect does an ocean have on the climate of the nearby landmass?
julie states that she wants to be her own boss. if she starts a business, it will be a proprietorship rather than a partnership or corporation
This enlightened monarch was an accomplished flutist allowed freedom of the press and made sure that judges were properly educated
how to explain 3 as a fraction
A field has a length of 50.5 meters, and a width of 9.2 meters. What is the perimeter and the area of the field?
​ Quadrilateral ABCD ​ is inscribed in this circle. What is the measure of angle C? Enter your answer in the box.
If this trisomic male (ey+ ey-, gw+ gw-) is crossed with a (ey− ey−, gw− gw−) female, what proportion of the progeny will be phenotypically wild-type?