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

[(24+16) divided by 8 times 5)]=? Please answer pllleeeaaaasee.
Why was FDR's Court Packing Plan a mistake?
if a sample of magnesium has a mass of 60 g, how many moles of magnesium does the sample contain
Solve the equation: 1/4 + w = 6 1/3
How do you solve p+9 <7 AND graph it???
Solve the equation:  4 1/5 + b = 9 3/5
one way in whick Robespierre and Louis XVI of France are similar is that both
Solve for x/4-x+2/6=x/3
luisa has 183 pennies. hert dad gives her 128 more write a number sentence to show many pennies luisa has now
Solve for x/4-x+2/6=x/3