Question: Please Need help in Python programming language. In question 1 part (a) and (b) part (A) Write a program that counts the number of occurrences
Please Need help in Python programming language. In question 1 part (a) and (b)
part (A)
Write a program that counts the number of occurrences of a word that is provided as an input by the user. Use your program to count the number of occurrences of the word lamb in the file mary.txt and the word miles in file frost.txt.
part (B)
Write a program that counts how often each word occurs in the supplied text files: mary.txt and frost.txt. Your program should output one line for each unique word that occurs in the text file in the format word: count, where word is a word from the file and count is the number of times that word occurs. Be sure to strip punctuation from words or your program will not produce the correct output.



Mary had a little lamb, whose fleece was white as snow. And everywhere that Mary went, the lamb was sure to go. It followed her to school one day which was against the rules. It made the children laugh and play, to see a lamb at school. And so the teacher turned it out, but stil1 it lingered near, And waited patiently about, till Mary did appear. "Why does the lamb love Mary so?" the eager children cry. "Why, Mary loves the lamb, you know." the teacher did reply
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
