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
The Windows Net use command is a quick way to discover any shared resources on a computer or server. True or False
V125BC [204]
Yes it’s true the window net use command is a quick way to discover any shared resources on a computer or server
8 0
2 years ago
What kind of advertising is used in Saunders's story when a man and his grandson walk down the street? O A. An individualized au
omeli [17]

Answer: An individualized audio device.

Explanation:

Advertising simply refers to an attempt which is made by an individual or company in order to influence the buying behavior of the customer by convincing them to buy a product.

The kind of advertising that is used in Saunders's story when a man and his grandson walk down the street is an individualized audio device. Therefore, the correct option is A.

8 0
3 years ago
Pressing the Ctrl+Home keys moves the insertion point to the
rewona [7]
I'm going to go with A
5 0
3 years ago
NEED HELP
valentina_108 [34]
It’s string. you can make the string bounce and make a sound.
7 0
3 years ago
Read 2 more answers
I need help with this question
weqwewe [10]

Answer:

<h3>C IS YOUR ANSWER</h3><h3>explanation is available</h3>

Explanation:

<h3>The digital divide describes the gap between people who have access to affordable, reliable internet service (and the skills and gadgets necessary to take advantage of that access) and those who lack it. ... The Access Divide—This is the most visible digital divide.</h3>
3 0
2 years ago
Read 2 more answers
Other questions:
  • ________ are the most popular method used by visitors to find web sites.
    6·1 answer
  • A company uses the account code 669 for maintenance expense. However, one of the company's clerks often codes maintenance expens
    15·1 answer
  • Computer keyboard failures can be attributed to electrical defects or mechanical defects. A repair facility currently has 25 fai
    14·1 answer
  • Which statement is true about the purpose of a work in process constraint?
    15·1 answer
  • Voice authentication requires speech to text capability Facial recognition may be used for authentication The human iris is uniq
    6·1 answer
  • Any device that uses light to read and write information.
    9·2 answers
  • Win10如何删除自己添加的环境变量?...............
    8·1 answer
  • WHAT DOES THE SCRATCH CODE BELOW DO?
    7·1 answer
  • A statement that starts with a # symbol is called
    8·1 answer
  • Question 2 of 10
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!