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
SOVA2 [1]
3 years ago
10

Design the program that reads two files and compares their contents. The program calls a method that reads the file one line at

a time. If the lines are the same the program skips the line. If the lines are different then the program prints the line number followed by the different lines from each file.
Computers and Technology
1 answer:
Advocard [28]3 years ago
5 0

Answer:

file1 = []

file2 = []

fileone = "lyric1.txt"

filetwo = "lyric2.txt"

def linereader( myfile, mylist):

   for line in open(myfile, "r") as file:

       line_read = readlines( line)

       mylist.append( line_read)

   file.close()

linereader( fileone, file1)

linereader( filetwo, file2)

# Assuming both files have same number of lines.

for index, item in enumerate(zip(file1, file2)):

   if item[0] != item[1]:

       print( index + 1, item)

Explanation:

The python code compares two files and returns the number and the lines from both files that do not match. The source code opens the files lyric1.txt and lyric2.txt reading each lines to different lists which are iterated to compare its items returning the number of the line and the unequal lines.

You might be interested in
Answer to this problem
True [87]

Answer:

hi..,.................................................

3 0
3 years ago
How is an interpreter different from a compiler?
lyudmila [28]

Answer:

An interpreter is quite different from a complier due to the following statement below:

O. An interpreter translates and executes code line by line, while a compiler translates all code at once so that it is ready to be executed at any time.

Explanation:

For an interpreter, it works in translating and execution of the codes line after another line. In a situation where there is a mistake in the code, the next line would not be able to be executed, but rather display error message. On the other hand, compiler translate all codes at once and execute them as a single work.

<em>During its translation of the codes in compiler, should there be any error, it would not be able to execute despite the fact that, the error might be in the last line of the code.</em>

7 0
3 years ago
Read 2 more answers
IT professionals have a responsibility to educate employees about the risks of hot spots. Which of the following are risks assoc
kodGreya [7K]

Answer:

third partying and computer hackers.

Explanation:

7 0
3 years ago
Which Computer career field enables you to create and design interactive multimedia products and service
Stells [14]
The answer is Web and Digital communications
4 0
3 years ago
Read 2 more answers
How do most business applications and websites process credit card transactions?
klasskru [66]

Answer:

The answer to this question is given below in the explanation section.

Explanation:

Most business applications and websites use and process the credit card for their transaction.

For example, e-commerce website such as ali baba, am a zon, accepting credit card transaction when the customer gets to purchase any product from their stores. Their transactions are processed by in house credit card apps/service. But these apps/services owned by a third party. They just give you API services and related code to integrate the credit card services.  

By using their in-house credit card apps/services, they know that user has transferred the money into their account for the purchased product, upon receiving payment confirmation, they then prepare and dispatch the order.

So, the correct answer to this question is:

To process the credit card transactions, they license third-party credit card apps/services backed by the internet merchant who is responsible for handling and managing the money of the business account.    

6 0
3 years ago
Other questions:
  • A(n) ________ address is a temporary ip address assigned from an available pool of ip addresses.
    12·1 answer
  • According to Holpp and Kelly's approaches to developing vision, the benchmarking approach is more internally focused, whereas th
    6·1 answer
  • How do optical discs store data? select one:
    15·1 answer
  • What is the ability for a system to respond to unexpected failures or system crashes as the backup system immediately and automa
    8·1 answer
  • If you want Nud3s add me on sc Kermit4lyfe1
    11·2 answers
  • How does an individual's access to a wide range of online services affects their ability to operate safely in the digital world.
    5·1 answer
  • Using the Impress program, you can add multimedia files, including audio, image, and video files, to the presentation
    13·2 answers
  • MR. Tom asked her students could they plant a flower and bring it to class. Sarah brought his flower and said it was a rose. Jam
    6·1 answer
  • Below functions flatten the nested list of integers (List[List[int]]) into a single list and remove duplicates by leaving only t
    15·1 answer
  • Create a timeline of the evolution of computers and their impact on society
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!