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 did the Shinto belief system develop in early Japan? A) Clans collected shrines to worship their ancestors B) Buddhist Ideas developed into Shinto beliefs C
Are any rocks that form from another rock as a result of change in blank or blank
why is caesar in a courthouse
create a scenario for the equation y=1/3x thanks!
Tara has $2,000 in her savings account. David has one-tenth as much as Tara in his savings account. How much does David have in his savings account?
Bob's gas tank is 1/2 full. After he buys 3 gallons of gas, it is 2/3 full. How many gallons can Bob's tank hold?
What type of subject is in the sentence?juan and carlos went to the store on friday??
what does 7+7 divided by 7+7*7-7
A local pizzeria sold 65 pizzas yesterday. Suppose the actual number of pizzas sold today was 60. Describe the number of pizzas sold as a percent increase or d
C++ code-- Factorial Recursion Write code to complete PrintFactorial()'s recursive case. Sample output if userVal is 5: 5! = 5 * 4 * 3 * 2 * 1 = 120 #include u