Answered step by step
Verified Expert Solution
Question
1 Approved Answer
In Python 3 The links to the files needed are at https://www.cse.msu.edu/~cse231/Labs/Lab10/ Thank you! Consider the file named lab10a.py. That file contains the skeleton of
In Python 3
The links to the files needed are at https://www.cse.msu.edu/~cse231/Labs/Lab10/
Thank you!
Consider the file named "lab10a.py". That file contains the skeleton of a Python program to do a simple analysis of two files: it will display the number of unique words which appear in the two files (the union of those two sets of words), as well as the number of unique words which are common to both files (the intersection of those two sets of words) Case does not matter: the words "pumpkin Pumpkin" and "PUMPKIN" should be treated as the same word. Only unique words should be counted: if a word appears more than once in a file, it should only be counted once. Note: remember to remove punctuation from words, e "it," should be "it a. Replace the comments labeled "YOUR COMMENT" in function "build word set" with meaningful comments to describe the work being done in the next statement. Use more than one comment line, if necessary b. Revise function "compare files" to accomplish the work described in the comments. c. Test the revised program. There are two sample documents available: "document1.txt" (The Declaration of Independence) and "document2.txt" (The Gettysburg Address) Demonstrate your completed program to your TA. on-line students should submit the completed program (named "lab10a.py") for grading via the Mirmir system. Part B: Programming with Dictionaries and Sets Consider the file named "lab10b.py". That file contains the skeleton of a Python program to display information about the words in a document. Function "main" is complete. It handles the interaction with the user and calls other functions to perform the appropriate tasks Function "print word index" is complete. It receives a dictionary, where each element is a word and a set of line numbers where that word appears in a document. It displays all of the words (in alphabetic order), along with the lines numbers for each word (in ascending order)Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started