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.