Question: please use python spider Part C This program will require you to use strings and lists. There re two inputs to the program: The program
please use python spider
Part C This program will require you to use strings and lists. There re two inputs to the program: The program will first request the user to input a sentence Then the program will request the user to input a string to search for in the sentence The program will need to print out the following: The number of characters in the sentence The number of words in the sentence The number of occurrences of the string in the sentence The proportion of number of occurrences of the string to the number of characters in the sentence The average word size calculated as the number of characters in the sentence divided by the number of words in the sentence. All proportions and floats need to be printed with three decimal accuracy. You are to base this program on material covered in class and in your notes for the first two weeks only. A sample execution and output are shown below (base) C:\temp>python AnswerPartc.py Please enter a sentence: The bat fell on the cat who fell on the mat. Please enter a string: at The number of characters in the sentence is: 44 The number of words in the sentence is: 11 The string "at" occurs 3 times in the sentence The proportion of "at" in the sentence is: 0.068 The average word size in the sentence is: 4.088 (base) C:\temp>
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
