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

Who is MOST responsible for the structure of U.S. branches of government?
Why did Croatia and Slovenia declare their independence from Yugoslavia?
The measure of ∠DAB equals 125º. The measure of ∠ACB equals 30º. What is m∠ABC?
what was Jacob Rios goal in the late 1800s?
need help with this question
Measure that determines the state of a substance
Factor the expression over the complex numbers. x^2+36
A $8920 note is signed for 160 days at a discount rate of 6.5% find the proceeds
the removal of nearly all the Predators from an ecosystem would most likely result in
A box contains 87 coins, only Dimes and nickels. The amount of money I the box is $5.45. How many dimes and how many nickels are in the box?