Ask Question
22 November, 12:12

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.

+4
Answers (1)
  1. 22 November, 12:31
    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?
Find 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 you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers