Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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.

image text in transcribed

image text in transcribed

image text in transcribed

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Securing SQL Server Protecting Your Database From Attackers

Authors: Denny Cherry

2nd Edition

1597499471, 978-1597499477

More Books

Students also viewed these Databases questions

Question

In Exercise 40 what is the

Answered: 1 week ago