Question: in PYTHON Write a function named duplicateWords() that identifies word in a file that occur more than once and then writes the duplicate words and
in PYTHON
Write a function named duplicateWords() that identifies word in a file that occur more than once and then writes the duplicate words and their frequency to a new file. The function duplicateWords() takes two string parameters. The first parameter is the name of an input file that exists before duplicateWords() is called. The second parameter is the name of an output file that duplicateWords() creates and writes to. You may assume that the input file is in the current working directory and you should write the output file to that directory as well. For each distinct word in the input file that occurs more than once, the function duplicateWords() should write a line to the output file containing the word, followed by a space, followed by the word frequency. The order of the lines in the output file doesnt matter. Assume that the input text contains only lower case letters and endlines (no capital letters or punctuation)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
