Question: This program reads a file called test.xt. You are required to write two functions that build a wordlist out of all of the words found

 This program reads a file called test.xt. You are required towrite two functions that build a wordlist out of all of the

This program reads a file called test.xt. You are required to write two functions that build a wordlist out of all of the words found in the file and print all of the unique words found in the file Remove punctuations using 'string punctuation' and striplT before adding words to the wordlist. Write a function build_wordlist] that takes a file pointer s an argument and reads the contents, builds the wordlist after removing punctuations, and then returns the wordlist. Another function find_uniquel] will take this wordlist as a parameter and return another wordlist comprising of all unique words found in the wordlist. Example Contents of testtxt test file another line in the test file Output another, file, 'in, ine, test, thel Code code.py New Full Screen 4. 5- def main): infile open("test.txt", 'r) word list build wordlist (infile) new wordlist find unique (word list) new wordlist.sort) print (new wordlist) 10 11 min)

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!