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 happens when a problem says per pound
how would u answer #10
why was the new england colonies settle
from 65 to 144 find each percent increase round to the nearest percent.
What is the cost of six filters if eight filters cost $39.92?
How does crusoe different from the spanish and english masters he left behind to develop the island?
What did the Monroe doctrine prohibit European countries from doing
Evaluate: cos(2arctan(1/3)) I used the double angle identity cos(2x) = cos^2x-sin^2x cos(2x)= (3/sqrt(10))^2- (1/sqrt(10))^2 = 2/25 2/25 was my answer to this
Find the lowest natural number which when divided by 12, 45, 15 and 10 leaves the remainder of 2 in each case.
Which of the following is the best example of a way human lifestyles affect environmental systems? Burning fossil fuels increases the amount of greenhouse gase