Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Need help with this problem. We are using Anaconda-Python(Spyder 3.5 or above), so please use python language. The professor says we could solve this in

Need help with this problem. We are using Anaconda-Python(Spyder 3.5 or above), so please use python language. The professor says we could solve this in as few lines as 6. Also type link into google chrome browser to get the (long) poem Othello. Use set operations if needed. Thank you so much
image text in transcribed
Write a program that shall eliminate duplicate words from a text file. The program shall: 1. Ask the user to enter a name of an existing text file; if the file does not exist or cannot be opened for any other reason, the program shall print an error message and terminate. Read the content of the file and eliminate all duplicate words, except for the first occurrence. For the purpose of this exercise, a word is any sequence of characters that does not contain any spaces, and two words are duplicates if they differ at most in the character case (e.g., "Mary" and "mArY are duplicates) Write the text without duplicates into the file nodups-XXX, where XXX is the name of the 2. 3. e program shall print an error message and terminate. Test program by removing duplicates from Othello: 4. http://www.gutenberg.org/cache/epub/2267/pg2267-images.html

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

Students also viewed these Databases questions