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 ratio represents $20 for every 4 cups of lemonade sold? 4/1 or 4, 1/5, 5/1 or 5
What is common between the quantities of area, density and speed?​
. Emma wanted to make an origami fish for each of her 22 classmates. She takes 30 minutes to make one fish. How long will Emma take to make all the fish? A 320
help me I m stuck on this question
Help please quick for c and d
What is the job of the scribe? A. Someone who extends and adds ideas B. The person who manages and guides the group OC. The person who writes down the group's i
The table above shows some values of the functions f and g. What is the value of f(g(1)) ? A) 2 B) 3 C) 4 D) 5
Find the perimeter of the image below
Select the correct answer. Which text structure has the author of this passage used? In 1908, my great-grandmother first arrived in this country, and she had fe
A force of 50 N stretches a string by 4 cm,calculate the elastic constant.