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

Ravi is running against two other candidates for student council president. All of the 750 students in Ravi's school will vote for student council president. H
After each soccer practice Scott Runs 4 sprints of 10 yards each complete exclamation to find how many practices it will take for Scott to have spent a total of
One difference between the development of Indian and Western European civilizations in the Dark (Middle) Ages was
What’s the slope that’s passed though (5,2) and (7,7)
When was Uruguay's first constitution adopted? 1807 1830 1903 1827
How many cell do we have
the underground railroad was created by?
What information does the color of a star tell you?
Samantha drew a picture of her house. She used the scale 1 inch : 2.5 feet. The house in her picture is 20 inches long. What is the length, in feet, of the actu
what is this solution for x? 10000=20000(0.85)^x