Question: PYTHON PROGRAMMING Write a program that shall eliminate duplicate words from a text file. The program shall: 1. Ask the user to enter a name
PYTHON PROGRAMMING

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. 2. 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). 3. Write the text without duplicates into the file nodups-XXX, where XXX is the name of the original file. If the output file cannot be created, the program shall print an error message and terminate
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
