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

John Sells Hamburgers For $3 Each and cheeseburgers for $3.50 each. One afternoon, he sells a total of 24 burgers for $79. How Many hamburgers did he sell?
How do you find the interior angles of a triangle, if only one is given angle is given to you?
if the score is 90% and the total is 70 what is the number correct ?
What is one fact about xuchal
Who was Canada's FIRST prime minister.
A hiking club has 9 members. How many ways can they choose a president, vice president, secretary, and treasurer from among the members?
The ratio of Sam age to Hanks is 5 to 3. If the sum of their ages is 24, how old is Hank?
if the score is 90% and the total is 70 what is the number correct ?
In the top row of an chessboard, Tom writes the values 1, 2, 4, 8, 16, 32, 64, 128. In the leftmost column, Tom writes the values 1, 3, 9, 27, 81, 243, 729, 2
If (3+y)/y=7, then y= Please help :)