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

Verify as an identity: cos(90°+x) = -sinx I'm not sure how to go about this question
What is the answer to this problem? X+ 5/12=5/8
Which is the best description of England's North American settlement attempts before 1600? A. They did very well. B. There were no attempts before 1600. C. They
Find the Zero of the function f(x)=(0x-3)(x+4)
Music videos gave pop musicians a visible presence that helped them sell more music. Question 18 options: 1) True 2) False
The United States joined with (the) ____ to enter into Iraq in 2003. A) French B) United Nations Security Council C) North Atlantic Treaty Organization (( NATO
In a gymnastics competition, Holly and Julia scored a total of 107 points. Holly scored 35 more points than one half of Julia’s points. Write and solve an equat
What value of y makes the equation true? 3.4 + y = –6.85 A. –10.25 B. –3.25 C. 3.25 D. 10.25
seb bought 2 apples and 3 pears. He spent £1.59 altogether Apples cost 24p each. How much does one pear cost??
Which of the following mirrors public opinion but also helps shape it? (A) political parties (B) personal contact (C) the family (D) the media