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

a symbol for caledonium
How does the suffix change the meaning of the base word in instruction
Greg ran 3 times as far as jed.rj ran 0.1times as far as Greg. If jed ran25 yards, how far did Greg and rj run
14.8256 in expanded form
the ratio of red jelly beans to yellow is 3:4. If greg eats 3 red and 6 yellow, the ratio is 4:5. How many yellow jelly beans were originally in the dish?
when a falling object reaches a speed called terminal speed, its speed is no longer unceasing. the object id loosing gravitational potential energy nut no kinet
is -4 5/12 a rational or irrational number?
Factorise fully. X^2 +6x+5
In which phase of the cell cycle do cells grow and synthesize new proteins and organelles
divide 33photos into two gruops so the ratio is 4to 7