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 sequence lists the structures from largest, most inclusive, to smallest?
What landform feature does the model show, and what do hachures on contour lines indicate?
Geo The graph of a polynomial function of degree 5 has three x-intercepts, all with multiplicity 1. Describe the nature and number of all its zeros. A) The fun
1. Which number is irrational? A. 5/4 B. square root of 20 C. 0.4444 D. 2/3 2. Which number has the same value as the square root of 4 to the 3 power? A. S
Which one of the following choices is a good way to overcome frequent travel as a barrier to physical activity? Learn a new skill that you've always been intere
Round 521.362 to the nearest tenth. Help Me
The oriental trading company uses a cost leadership strategy. it has a "110% lowest price guarantee," which says that if a customer can provide an advertisement
When you shake your head instead of saying "no," what function of nonverbal communication are you using?
4 Solve for y . 5x − 10y = −40 A y = −2x − 4 B C D y = 2x + 4
What is .87 rounded to the nearest hundred in decimal form?