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

Is this written correctly? Anybody can provide a particular service but what are the benefits from what is being offered
Please answer the questions given in the picture.​
You have decided to take up carpentry and build your mother a set of shelves. However, you have not refined your skills very well and while sanding the shelves
use tables to evaluate√{3.45×16.7÷31.5)​
explain why the powder should not be used in boiling water​
An hourly employee needs to fill out her time sheet. What information must the employee enter in the chart before getting paid? total hours worked day of the we
Ned’s frog jumped 38/100 meter. Then his frog jumped 4/10 meter. How far did Ned’s frog jump
Select the best transition words or phrases in the text below. Cooking is a valuable skill that will serve students for the rest of their lives. Therefore, all
In what ways, if any, does a single-celled organism differ from its parents
Assertion (A): Oxygen is essential for all aerobic forms of life.Reason (R): Free oxygen atoms combine with molecular oxygen to form ozone.​