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

What is the slope between each pair of points. (-5,-2) and (9,2)​
10. Which of the following mirror is used to form smaller image of bigger field of view? (NSO Olympiad) a. plane mirror b. convex mirror c. concave mirror d. no
Please be quick! I need this as soon as possible!
What is the direct object in the sentence I help my sister with her Spanish homework.
Katherine is preparing for a job interview. She wants to research the company she is interviewing with. Where should she start?
Plzzzz help due tomorrow
Given the equation y = 3x + 2 , what is the value of x when y = 8?A) 2 B) 4 C) 6 D) 9
Which row accurately represents photosynthesis when substituted into the equation
Factor this trinomial completely. 2x + 10x + 8
I need help with b and c