Question: Using the DSU pattern, write a program that reads through the mail box data and when you find a line that starts with From, extract

Using the DSU pattern, write a program that reads through the mail box data and when you find a line that starts with From, extract the address information from the line. Count the number of messages from each person by using a dictionary. Note that you might need to look at more than From because of duplicate instances of the address (hint: From vs. From:, not both!). Otherwise, embedded email thread histories may cause your count to be incorrect. In other words, when counting the message "sends", you definitely don't want to count any embedded messages that are included as part of the message thread history. The idea is to count "original" sends. If you send me a message, and I respond, you respond to my response, etc., etc.,... how many times did you send that original message? Only once, right?2. After all of the data has been read, print (i.e., print) a message to the user stating that the person with the highest number of sent messages is , along with the number of sent messages associated with that email address (e.g., with n messages). In other words, as with any informatics output, your output should be meaningfule.g., The person with the highest number of sent messages is neo@matrix.com with 7700 messages. To obtain your result, create a list of tuples (count, email) from the dictionary, sort the list in reverse order and print out the person who has the highest number of messages. The U in DSU does not mean that you print a list, and it doesn t mean that you print a tuple. Rather, it means that you Undecorate, i.e. extract the necessary information from the tuple and present it to the user in a meaningful form (something your boss will understand).Note: To succeed with this assignment, know your data! When your program counts the messages, how do you know if you are counting the messages correctly? Could you be counting the same message more than once? If your program were to operate correctly, how would you know it? Is there a smaller file that you can use to test your program? (Hint: Theres a file named mbox-short.txt.)Deliverable:Two files as attachments at our course shell assignment page. The first file should be a Python .py file with the specified functionality. Please ensure that your full name is specified as a Python comment at the top of the .py file. The second file should be a screenshot image file (.png or .jpg) demonstrating the correct execution of your program with mbox.txt.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!