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
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