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

2-3 main human factors that have impacted the environment of central and South America. write a 5 sentence paragraph explaining these factors.
Ron runs at a speed of 3 1/2 miles in 1/2 of an hour.How fast is his average speed per hour?
Which estimate best describes the area under the curve in square units? 10 units² 15 units² 25 units² 30 units²
At a recent baseball game, anyone under the age of 12 was given one free hotdog. Travis had to pay for the hotdog that he ate. How old must Travis be? A. 1
Why does Jim say I’s rich now
A food exchange system is often prescribed for diabetic patients. This system considers__as an “exchange”
Which pair of triangles is congruent by ASA?
What is the book of the dead
if the theoretical yield of a reaction is 26.0 grams and you actually recovered 22.0 grams what is the precent yield
Complete the sentences on the cell cycle with the correct terms.