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

find the circumference of a circle whose radius is 15.4cm
What value of x makes the equation true ? 4(2x-4)=16
jasmines cd collection is 3/8 jazz 1/4 rap and the rest is rock music what is the fraction of rock music
All of the following expressions have a value between 0 and 1, excepta. \frac{(-3^{7})}{(-3)^9}b. 4^{-10}× 4^{6}c. \frac{(8^3)^3}{8^{-4}} d. ( \frac{2}{5} ^{8})
find the circumference of a circle whose radius is 15.4cm
find the circumference of a circle whose radius is 15.4cm
In scientific notation, what is the sum of 2.3 times 10^{-3} and 5.4 times 10^{-4}?a. 2.84 times 10^{-3}b. 5.63 times 10^{-3}c. 7.7 times 10^{-7}d. 12.42 times
In scientific notation, what is the sum of 2.3 times 10^{-3} and 5.4 times 10^{-4}?a. 2.84 times 10^{-3}b. 5.63 times 10^{-3}c. 7.7 times 10^{-7}d. 12.42 times
All of the following expressions have a value between 0 and 1, excepta. \frac{(-3^{7})}{(-3)^9}b. 4^{-10}× 4^{6}c. \frac{(8^3)^3}{8^{-4}} d. ( \frac{2}{5} ^{8})
find the circumference of a circle whose radius is 15.4cm