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

how to solve multi step equation
Solve the inequality: x(x+2)(x-2)<=0
Bill owes $425.07 on his credit card. He returns two items, one for $45.55 and the other for $54.68. Then he makes purchases of $36.59 and $33.19. What is the n
Write an equivalent expression for (x-3)(x-2)
Answer for beaker A and B
What is 3.315 rounded to the nearest hundredth
There are 87 green balls and 41 red balls in a bag. If one is randomly selected, what is the probability that it will be a green ball? Write answer as a decimal
What factors led to Europe voyages of exploration?
number 29 please, and show work if you can
What is the purpose of On Noise by Seneca?