[solved]-Assignment Continues Experience Working Strings Lists Data Stored Files Functions Decision Q39092436

This assignment continues yourexperience working with Strings, Lists, data stored in files,functions and decisions with Booleans. Take the time to review thetextbook sections on Strings, Lists and File Processing (Zelle Ch5), functions that return values (Ch 6.5), multi-way decisionhandling (Ch 7.3), and computing with Booleans (Ch 8.4) beforestarting this assignment. Problem Description Your assignment is towrite a Python program named labprep7.py which prompts the user fortwo (2) filenames, (a ‘words’ file and a ‘search’ file). Then,after reading a sequence of individual words from the words file,the program searches through the search file to find occurrences ofeach word. The words and the number of times they occur are thendisplayed. >>> main() Enter words filename: words1.txtEnter search filename: search1.txt tears 1 go 1 i 4 you 7 love 2when 3 What do I do, When I’m still in love with you? You walkedaway, ‘Cause you didn’t want to stay. You broke my heart, you toreme apart. Every day I wait for you, Telling myself our love wastrue. But when you don’t show, more tears start to flow. That’swhen I know I have to let go. Filename: search1.txt Tears go I youLove when Filename: words1.txt CS 177 Summer 2019 Page 2 of 3 TODO#1: Setup your Python program file labprep7.py Include thefollowing in your labprep7.py file: • A header including your nameand describing the program’s function and purpose • Three separatefunction definitions: words(), search() and main() • The last lineof the labprep7.py Python program should call the main() function.• All other commands should be within the 3 function definitionsTODO #2: Define the words() function to read a List of words tofind The words() function accepts one parameter, a String, andperforms the following tasks: • Opens the words file using thefilename specified by the String parameter • Reads the contentsfrom the words file into a new List of Words • Closes the wordsfile • Converts all Words in the List to lower case and removes anypunctuation, (commas, parenthesis, quotes, periods, etc) • Returnsthe List of Words TODO #3: Define the search() function to find theword occurrences The search() function accepts two parameters, aString containing a filename and the List of words and performs thefollowing tasks: • Opens the search file using the filenamespecified by the String parameter • Reads the contents from thesearch file • Closes the search file • Converts all characters readfrom the search file to lower case and removes any punctuation(commas, parenthesis, quotes, periods, etc) • Finds the number ofoccurrences of each word from the parameter List. • Stores eachword and number of occurences in a new word occurrences List •Return the word occurrences List TODO #4: Write the main() functionto bring it all together The main() function accepts no parametersand performs the following tasks: • Prompts the user for the wordsfilename • Prompts the user for the search filename • Calls thewords() function to retrieve the List of words • Calls the search()function to retrieve the List of word occurrences • Prints thewords and their number of occurrences (as shown in the example onpage 1)
Lab Prep 7 Due Date This assignment is due by 11:59 pm on Wednesday, July 17th Before you begin This assignment continues your experience working with Strings Lists data stored in files. functions and decisions with Booleans. Take the time to review the textbook sections on Strings Lists and File Processing (Zalle Ch 5), functions that return values (Ch 6.5), multi-way decision handling (Ch 7.3) and computing with Booleans (Ch 8.4) before starting this assignment Problem Description Your assignments to write a Python program named labpreppy which prompts the user for two (2) filenames, a words’fle and a search Sle). Then, after reading a sequence of individual words from the words file, the program searches through the search file to find occurrences of each word. The words and the number of times they occur are then displayed Enter wondellen word .LXL When the in love with you? Page 1 of 3 TODOS your Python program file labore Include the following in your labprep.py file: • A header including your name and describing the program’s function and purpose • Three separate function definitions: words ), search and maint • The last line of the labprep.py Python program should call the main function • All other commands should be within the 3 function definitions TODO 82: Define the words function to read a list of words to find The words() function accepts one parameter, a String, and performs the following tasks: • Opens the words file using the filename specified by the String parameter • Reads the contents from the words file into a new List of Words • Closes the words file • Converts all Words in the List to lower case and removes any punctuation, (corrimas. parenthesis, quotes, periods, etc) • Returns the List of Words TODO N3: Define the search function to find the word occurrences The search() function accepts two parameters, a String containing a name and the List of words and performs the following tasks: • Open the search file using the filename specified by the String parameter • Reads the content from the search file • Closes the search fie • Converts all characters read from the search file to lower case and removes any punctuation (comes parenthesis, quotes, periods, etc) • Find the number of occurrences of each word from the parameter List • Stores each word and number of occurences in a new word Occurrences List • Return the word occurrences List TODO 14: Write the function to bring it all together The main() function accepts no parameters and performs the following tasks: • Prompts the user for the words filename • Prompts the user for the search filename • Calls the words () function to retrieve the List of words • Calls the search function to retrieve the List of word occurrences • Prints the words and their number of occurrences (as shown in the example on page 1) Show transcribed image text Lab Prep 7 Due Date This assignment is due by 11:59 pm on Wednesday, July 17th Before you begin This assignment continues your experience working with Strings Lists data stored in files. functions and decisions with Booleans. Take the time to review the textbook sections on Strings Lists and File Processing (Zalle Ch 5), functions that return values (Ch 6.5), multi-way decision handling (Ch 7.3) and computing with Booleans (Ch 8.4) before starting this assignment Problem Description Your assignments to write a Python program named labpreppy which prompts the user for two (2) filenames, a words’fle and a search Sle). Then, after reading a sequence of individual words from the words file, the program searches through the search file to find occurrences of each word. The words and the number of times they occur are then displayed Enter wondellen word .LXL When the in love with you? Page 1 of 3
TODOS your Python program file labore Include the following in your labprep.py file: • A header including your name and describing the program’s function and purpose • Three separate function definitions: words ), search and maint • The last line of the labprep.py Python program should call the main function • All other commands should be within the 3 function definitions TODO 82: Define the words function to read a list of words to find The words() function accepts one parameter, a String, and performs the following tasks: • Opens the words file using the filename specified by the String parameter • Reads the contents from the words file into a new List of Words • Closes the words file • Converts all Words in the List to lower case and removes any punctuation, (corrimas. parenthesis, quotes, periods, etc) • Returns the List of Words TODO N3: Define the search function to find the word occurrences The search() function accepts two parameters, a String containing a name and the List of words and performs the following tasks: • Open the search file using the filename specified by the String parameter • Reads the content from the search file • Closes the search fie • Converts all characters read from the search file to lower case and removes any punctuation (comes parenthesis, quotes, periods, etc) • Find the number of occurrences of each word from the parameter List • Stores each word and number of occurences in a new word Occurrences List • Return the word occurrences List TODO 14: Write the function to bring it all together The main() function accepts no parameters and performs the following tasks: • Prompts the user for the words filename • Prompts the user for the search filename • Calls the words () function to retrieve the List of words • Calls the search function to retrieve the List of word occurrences • Prints the words and their number of occurrences (as shown in the example on page 1)
Expert Answer
Answer to This assignment continues your experience working with Strings, Lists, data stored in files, functions and decisions wit… . . .
OR

