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

Rome became the political capital of the kingdom of italy after________?
how do you know when and angle is supplementary to another angle
Consider the expression 17x+8x+35.Which of these mathematical statements could be used to accurately describe the given expression?Select all answer choices tha
Given: p is true Prove: p → q is true Assume ~q is true. Then ~q → r, and r → s. Since s → ~p, ~q → ~p by the law of syllogism. Therefore, p → q is true. What
It's advisable to start saving and investing as early as possible in order to A. take advantage of compound interest. B. avoid paying taxes. C. take adva
What was the reason for creating the United Nations Security Council?
JKL has vertices at J(-4,-2) K(1,-1) and L (-2,-4). Determine if JKL is a right triangle.
How do I solve 5(3n-4)
If the argument of a complex number in polar form is 3pi/2, then it lies on the _____.
A container holds 6 quarts of lemonade. How much is this in cups?