Question: In Python Your program should output the total umber of words and Write a program that asks the user for a list of nouns (separated
In Python
Your program should output the total umber of words and Write a program that asks the user for a list of nouns (separated by spaces) and approximates the fraction that are plural by counting the fraction that end in " the fraction that end in "s". You may assume that words are separated by spaces (and ignore the possibility of tabs and punctuation between words.) A sample run of the program: bananas cantalopes durian Enter nouns: apple Number of words: 4 Fractinn of your list that is plural is .s And another sample run of the progra: Enter nouns: hats aloves coats elasses scarves Nunber of Hord: 5 Fraction uf your list that is plural is 1.0 Hint: Break this problem into pieces: 1. First, count the mmber of words in the sting the user entered (int: cout the mumber of spaces). Prant out the mumber ofwords. Make sture ths works before gong onto the mext part 2. Next, ignoring the last word (hch is a speczal case and can be dealt with separately), cownt the number of words endingi'scount the mmber of "s ". Test that this part works before going on to the next step .Last, check the last word to see if it ends m"- since it's the last word, the "s"will ahways accur at the same mdex in the string Inplement (and test!) each part and then go on to the next
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
