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

simplify. (½) ²− 6(2−2/3)
a particle that orbits the nucleus in an atom is called a(n)
Most Keyboards today are arranged in a (n) layout?
Yo __________ en la casa
The XYZ PAC operates on behalf of the XYZ interest group. Which campaign behavior of the XYZ PAC would be against current law? A. The PAC creates its own camp
The sum of two consecutive, odd whole numbers is 205. What are the two numbers? Hint: if x is the first number then x + 1 would be the other number as they are
if y = mx b is the equation of a line perpendicular to the line y = 5x – 2, what is the value of m?
1. Which of these was a precedent that George Washington set? (5 points) constitutional amendment process formal presidential dinners singing of the national
how long does it take for plaque to renew itself on the tooth surfaces?
why don't north and south korea get along?