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

What role did the military play in many Latin American countries during the 1920s and 1930s? Use specific examples to support your answer.
All quadrilaterals have four sides. All squares are quadrilaterals. Therefore, ________________ all polygons are squares. all squares are parallelograms. all sq
A candle shop sells scented candles for $16 each and unscented candles for $10 each.The shop sells 28 candles today and makes $400.How many scented candles did
Which two elements have the most similar chemical properties? (1) Be and Mg (3) Cl and Ar (2) Ca and Br (4) Na and P
how was the idea of citizenship changed throughtout histpry
−4x + y = 6 −5x − y = 21
A 133.8-gram sample of bronze was 10.3% tin by mass. Determine the total mass of tin in the sample.
the sum of two consecutive even integers is -22, what are the two numbers?
In which order did this sequence of events from Texas history occur? 1. Texas became the 28th state in the United States. 2. People from the United States settl
what is the log(45)/log(15) simplified?