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

Which period was the “golden age of dinosaurs”? a. the Triassic Period b. the Jurassic Period c. the Cretaceous Period d. the Tyrannosaurus Period
How many grandparents have my grandparents? who can solve it is very good on maths! it is just a lpgic problem! i know the answer :)
What is the slope of any line parallel to the line 8x + 9y = 3 in the standard (x,y) coordinate plane?
how do day and nightat uranus's equator change asthe uranus revolves around the sun?
how do day and nightat uranus's equator change asthe uranus revolves around the sun?
how do day and nightat uranus's equator change asthe uranus revolves around the sun?
Can someone please help me ?
Why were people from Africa brought to Georgia?
what is the kingdom and phylum of a euglena protest?
what does etymology study?