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
100 POINTS PLEASE HELP
Oksana_A [137]

Answer:

hope this helped ,do consider giving brainliest

Explanation:

import numpy as np

#PrintArray Function

def printArray(array):

for i in range(len(array)):

for j in range(len(array[i])):

print(array[i][j], end= " ")

print()

#Flip horizontal function

def flipHorizontal(array):

#reversing the order of arrays

array2 = np.fliplr(array).copy() printArray(array2)

#Flip Vertical function

def flipVertical(array):

#Preserving the order of array and reversing each array.

array3 = np.flipud(array).copy() printArray(array3)

#Main() function def main():

array = [[0,2,0,0,0],[0,2,0,0,0],[0,2,2,0,0],[0,2,0,2,0],[0,2,0,0,2]]

print("The array: \n")

printArray(array)

print("\nFlipped horizontally: \n") flipHorizontal(array)

print("\nFlipped vertically: \n") flipVertical(array)

if __name__=="__main__":

main()Explanation:

6 0
2 years ago
Read 2 more answers
How do technologies such as virtual machines and containers help improve
Alla [95]
The answer is.. D. By allowing multiple applications to run on a single server.

Got 100% on test!

Hope this helps!!
8 0
2 years ago
What does % find on edhesive??
statuscvo [17]

Answer:

Explanation: What is that word you typed?

3 0
3 years ago
Match the steps with the actions that are involved when an internal host with IP address 192.168.10.10 attempts to send a packet
Anna35 [415]

Answer:

Following are the steps with actions that are involved in required to perform a packet transfer.

Explanation:

  • Step 1: The host sends a connection request to server which is at IP address 209.165.200.254
  • Step 2: R1 check the configuration of NAT to inquire weather the packet should be translated or not.
  • Step 3: If there is no entry found for translation of given IP address, It is assumed that the IP address 192.168.10.10  will be translated already.
  • Step 4: R1 selects a global address  from the dynamic address pool that is available to it.
  • Step 5: R1 replaces the given IP address 192.168.10.10  with the translated inside global address.

i hope it will help you!

5 0
3 years ago
Talia was a scientist whose research compared the birth rates of young women of a New England community over the course of five
podryga [215]

Answer: b

Explanation: for me personally i will populate an infographic(chart)rather than essay form i prefer to use an infographic to show my anaylis how it went high or low or when.

8 0
3 years ago
Read 2 more answers
Other questions:
  • Bianca is preparing special dishes for her daughter’s birthday. It takes her a minutes to prepare the first dish, and each follo
    11·1 answer
  • A file containing user information which is transmitted from an online server and attached to your web browser and stored on you
    11·1 answer
  • Naruto Uzumaki who likes naruto ??? who waches it??
    14·2 answers
  • Which of the following is the most significant outcome of the formation of the SMPTE?
    6·2 answers
  • Implement the following logic in C++, Use appropriate data types. Data types are represented as either numeric (num) or string.
    5·1 answer
  • Where are domain user passwords stored?
    10·1 answer
  • it has been said that television has little real educational value. what is your opinion on this issue?
    11·1 answer
  • Write a program that demonstrates the class by creating a Payroll object, then asking the user to enter the data for an employee
    8·1 answer
  • Why is my computer fans making weird noises?
    12·2 answers
  • Identify the true statements about the approach to privacy around the world. a. Uncertainty concerning the nature, extent, and v
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!