Question: Write a function called file_compare(myfile, correctfile) that compares two text files line by line (you can assume that the files have the same number of

Write a function called file_compare(myfile, correctfile) that compares two text files line by line (you can assume that the files have the same number of lines). If the lines are different, the function prints out a list of the characters in the line for the first file and the corresponding line in the second file so that the user can inspect the difference. Make sure your comparison shows the blank characters i.e. space, , \t that print out as blanks on the screen if you use print(). You can then use this function to compare the output of your homework assignments to the outputs provided in the homework assignments. (Hint: you may want to use file.readlines()) Test your function against the two files provided called myfile.txt and correctfile.txt?

Has to be in python program language

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!