Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Spatio Temporal Database Management International Workshop Stdbm 99 Edinburgh Scotland September 10 11 1999 Proceedings Lncs 1678

Authors: Michael H. Bohlen ,Christian S. Jensen ,Michel O. Scholl

1999th Edition

3540664017, 978-3540664017

More Books

Students also viewed these Databases questions

Question

1. Where do these biases come from?

Answered: 1 week ago

Question

7. What decisions would you make as the city manager?

Answered: 1 week ago