Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Exercise 3.2 (design, simplediff.py) Before attempting to code this problem, create a file design that contains some analysis of how you think the problem will

image text in transcribed
Exercise 3.2 (design, simplediff.py) Before attempting to code this problem, create a file design that contains some analysis of how you think the problem will be solved. Examples include but are not limited to: a flowchart of events in the program, pseudocode, or a step-by-step process written in plain English. If you choose to scan your design, please make sure that it is legible Write a "diff" program that prints out the differences, line by line, of two files. Your program should ask the user for the names of two files, then print the differences between them. Follow the format output as shown below. Make sure to use proper error handling techniques for file I/O. Assume all files have the same number of lines. The following output shows the output of the files file1.txt and file2.txt ? $ cat file1.txt 2 John goes to work 3 Keith and Kyle went to the Ensiferum concert Alice ate an apple pie s Joe cut down a tree The dog jumped over the vall $ cat file2.txt s John goes to work Coral went to a Kesha concert e Alice ate an apple pie u Joe planted a tree 12 The dog jumped over the vall This is the result of running the script simplediff.py on the two files: python aimplediff.py 2 Enter file name 1 file1.txt Enter file name 2>> fil1e2.txt s 2c0 sKeith and Kyle went to the Ensiferum concert s > Coral vent to a Kesha concert 9 4c4 10 Joe planted a tree The 2c0 tag refers to where the difference occurred and can be read as line 2 character 0 (where lines are 1 indexed and characters are zero indexed). Compare the output of your script to that of the diff program by typing diff file1.txt file2.txt in your shell

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions