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

so if bob spilt 5.9 milk in a cup how much milk does he have
The Carter family has 12 cousins. Three of the cousins live in Chicago, five of the cousins live in Detroit, and the rest live in New York. What ratio of the co
If g(x) = 4x - 3 and h(x) = -4x, what is g(5) + h(3)?
Cell d1 contains the value 7. 877. You want cell d1 to display this value as 7. 9 but keep the original number in calculations. How can you accomplish this?.
Which expression is equivalent to 2m^2-m^2(7-m)+6m^2 1. m^2-m 2. -m^3+13m^2 3. -m^3+m^2 4. m^3+m^2
como trabajan juntos los musculos y los huesos
Substitute the value in for the variable. Then solve. Remember your order of operations!4(50+n) when n = 2​
anics Precautions: State the precautions taken to ensure accurate results in a projectile motion experiment​
A)Name two processes by which the mineral salts enter the organisms B) how do they get to the growing points at the top of the plant
Read the excerpt from brown v. Board of education. In each of the cases other than the delaware case, a three-judge federal district court denied relief to the