Assignment 2: Worth 11% of the Homework grade Due: Wednesday, June 24th at 11:59 pm To turnin program 2 (mypatch.py) from lectura, type % turnin 380assignment2 mypatch.py 1. Write a python program called "mypatch.py" that allows you to reconstruct a new file, given the diffs and an older version of that file. The program will be invoked in the following way: % python mypatch.py original_file diffs output_file The program should have no output, but will create the file named 'output_file' which applies the diffs to the original file. For example: If file a contains: a = 1 b = 2 c = 3 d = 4 e = 5 And a_diffs contains: 2d1 < b = 2 4c3 < d = 4 --- > d = number 4 5a5,6 > f = 6 > g = 7 Then, to running mypatch to create file b % python mypatch.py a a_diffs b ...should create file b: a = 1 c = 3 d = number 4 e = 5 f = 6 g = 7 This program is similar to the Unix command "patch" (but has a different invocation syntax: "patch" changes the original file). In fact, I encourage you to use "patch" to verify your program is doing the right thing. You may NOT invoke "patch" (or any other Unix command) in your program to do your work for you [anyone who does gets an automatic 0]: the purpose of this assignment is for you to learn strings (via parsing diffs options) and to do file Input/Output yourself from Python. % man patch We are assuming that the diffs file is well-formed (i.e., it looks like the output of the diff command). We encourage you to experiment with diff to get some more examples. (We will be discussing the diff command in class as well). % diff file1 file2 > diffs_in_file # Put diffs in a file % diff file1 file2 # See diffs on screen % man diff # Looks at help