Question: Write a Python function that counts and returns the number of words in a line of text. Use the function to count the number
Write a Python function that counts and returns the number of words in a line of text. Use the function to count the number of words for each line in the following list, as well as the total number of words in the entire list. shakespeare = [ "Be not afraid of greatness", "Some are born great", "some achieve greatness", "and others have greatness thrust upon them"] Print each line of the text with its subtotal. Print the total for the entire list. Format each line, The printed output should look like this: Be not afraid of greatness Some are born great some achieve greatness and others have greatness thrust upon them Total: 19 5437 7
Step by Step Solution
There are 3 Steps involved in it
Here is a Python function that counts and returns the number of words in ... View full answer
Get step-by-step solutions from verified subject matter experts
