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

A medication order is for 2 1/4gr. of a drug to be given tid. you have 3/4gr. tabs in stock.a. how many tablets would you give with each dose?b. How many tablet
Which city is warmer, juneau (-20° c. or little rock (-2° c.?
Which of th following is not a benefit of cardiorespiratory fitness?
Suppose a scientific team is trying to recreate the energy-producing reactions that occur in the sun. what would they need for the experiments? a hydrogen atoms
could someone help me answer these questions please
Can you make a triangle with side lengths of 7, 8 , and 15? Explain
A solution of 1.50g of solute dissolved in 25.0 mL of H2O at 25C has a boiling point of 100.95C. What is the molar mass of the solute if it is a nonvolatile non
What could be a fraction in simplest form 5/5 division?
What is 998 divided by 9?
Centrally planned economies can work effectively toward explicitly stated goals