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

Please help me on this
Primates are considered to be the most advanced group of mammals. Which of the following characteristics is NOT common to all primates?
If the statement is true write true if it false change the under word or words to make the statement true
Populations with ________ levels of genetic diversity are _________ likely to adapt to changes in the environment. (2 points) high; less high; more low; more hi
Xavier wants to distribute his baseball card collection evenly among his 8 younger brothers. What equation can be used to find c, the number of baseball cards e
624 feet to 702 feet
Developing job skills has no benefit for guaranteeing a successful marriage? True or false
A substance that undergoes a physical change is still the ___________ substance after the change.
During the Antebellum period, religion was used by many Americans to
Central to Vygotsky’s theory of cognitive development is the idea that children increasingly make better sense of their world: