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

What role did George Washington play in the political events leading up to the American Revolution? Did he play a role in Virginia politics or the Continental C
What is the NUTRIENT needed as an energy store and insulation?
4. You are asked to make 125 grams of a 7% antifungal cream using tolnaftate powder and Eucerin cream. How many grams of tolnaftate powder are needed? Round to
How can an environmental law affect a business
If the profit is $8000 and the profit % is 4%, what are net sales?
What is this (pic provided) written as a single log?
The mineral we call diamond is the hardest known substance on Earth. Explain why attaching small pieces of diamond to the tips of saw blades and drill bits make
Let f(x) = -4x - 2 and g(x) = 5x - 6. Find f⋅g and state its domain.
didnt mean to comment
How old are spiral galaxies? I WILL MAKE YOU BRAINLIEST, 5 STARS, AND THANKS! PLEASE ASAP