1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
coldgirl [10]
3 years ago
8

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.
Engineering
1 answer:
mash [69]3 years ago
6 0

Answer:

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")

You might be interested in
HELP ME PLEASE RN
IRISSAK [1]

Answer:

information

Explanation:

see picture

8 0
3 years ago
Solid Isomorphous alloys strength
Sphinxa [80]

Answer:

Explanation:

ℎ

3 0
3 years ago
A program contains the following function definition: int cube(int number) { return number * number * number; } Write a stateme
Nonamiya [84]

Answer:

The statement can be written as

int result = cube(4);

Explanation:

A function is a block of reusable codes to perform some tasks. For example, the function in the question is to calculate the cube of a number.

A function can also operate on one or more input value (argument) and return a result. The <em>cube </em>function in the question accept one input value through its parameter <em>number </em>and the <em>number</em> will be multiplied by itself twice and return the result.  

To call a function, just simply write the function name followed with parenthesis (e.g. <em>cube()</em>). Within the parenthesis, we can include zero or one or more than one values as argument(s) (e.g. <em>cube(4)</em>).

We can then use the "=" operator to assign the return output of the function to a variable (e.g. <em>int result = cube(4)</em>)

8 0
3 years ago
Select the level of education that is best demonstrated in each example.
Nastasia [14]

Answer:

masters

associate

bachelors

Explanation:

8 0
3 years ago
Read 2 more answers
Using leftover paint colors is acceptable in a paint shop and will help cut down on waste.
Luden [163]
Im pretty sure it is true !
3 0
3 years ago
Read 2 more answers
Other questions:
  • A satellite orbits the Earth every 2 hours at an average distance from the Earth's centre of 8000km. (i) What is the average ang
    7·1 answer
  • The lab technician you recently hired tells you the following: Boss, an undisturbed sample of saturated clayey soil was brought
    6·1 answer
  • A pump is used to transport water from a reservoir at one elevation to another reservoir at a higher elevation. If the elevation
    5·1 answer
  • A wastewater treatment plant discharges 1.0 m3/s of effluent having an ultimate BOD of 40.0 mg/ L into a stream flowingat 10.0 m
    11·1 answer
  • Plot the following trig functions using subplots, choosing an appropriate layout for the number of functions displayed. The subp
    8·1 answer
  • You are watching the weather forecast and the weatherman says that strong thunderstorms and possible tornadoes are likely to for
    15·1 answer
  • Design complementary static CMOS circuits with minimized number of transistors to realize the following Boolean functions (hint:
    13·1 answer
  • How many volts of electricity would it take to power up an entire city? Take Tokyo for example. Please explain!
    12·1 answer
  • What would happen if the brake pedal was released while the bleed screw was open during brake bleeding?
    7·1 answer
  • Dndbgddbdbhfdhdhdhhfhffhfhhddhhdhdhdhdhd​
    11·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!