Ask Question
11 August, 12:24

Suppose the Bookstore is processing an input file containing the titles of books in order to remove duplicates from their list. Write a program that reads all of the titles from an input file called bookTitles. txt and writes them to an output file called noDuplicates. txt. When complete, the output files should contain all unique titles found in the input file.

+5
Answers (1)
  1. 11 August, 13:39
    0
    books = []

    fp = open ("bookTitles. txt")

    for line in fp. readlines ():

    title = line. strip ()

    if title not in books:

    books. append (title)

    fp. close ()

    fout = open ("noDuplicates. txt", "w")

    for title in books:

    print (tile, file=fout)

    fout. close ()

    except FileNotFoundError:

    print ("Unable to open bookTitles. txt")
Know the Answer?
Not Sure About the Answer?
Get an answer to your question ✅ “Suppose the Bookstore is processing an input file containing the titles of books in order to remove duplicates from their list. Write a ...” in 📙 Engineering if there is no answer or all answers are wrong, use a search bar and try to find the answer among similar questions.
Search for Other Answers