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

The oldest European town in Texas is Ysleta. Please select the best answer from the choices provided T F
this classified as a living or non living thing.​
Help me with these problems
Use the quadratic function f(x) = 2x2 + 4x +3 to answer the following questions. a) Use the vertex formula to determine the vertex. The vertex is (Type an order
I need help with this question someone
why is velocity called vector quantity while speed is a scalar quantity​
Amendments to the Constitution can be proposed by the president and vice president. Congress and state legislatures. the president and the Supreme Court. Congre
A good worker at a cafe prepares drinks with a pitcher of milk she store on the counter. The food worker washes her hands and puts on new gloves when switching
What is an equation for this line?
Which challenge faced by farmers during the late 1800s was caused by overproduction of crops?