Write a program in the Python programming language.
You will write a simple program called "reverse". This program should be invoked in one of the following ways:
1. promptsl/reverse
2. prompt>/reverse input.txt
3. prompt/reverse input.txt output.txt
The above line means the user typed in the name of the reversing program "reverse". The "prompt>" in front of it simply refers to the current working directory called "dot" (.), and the slash (/) is a separator. Thus, in this directory, look for a program named "reverse" and give it either no command-line arguments, one command-line argument (an input file, input.txt), or two command-line arguments (an input file and an output file, output.txt).
An input file might look like this:
hello this is a file
The goal of the reversing program is to read in the data from the specified input file and reverse it. Thus, the lines should be printed out in the reverse order of the input stream. For the aforementioned example, the output should be:
afile 15 this hello
The different ways to invoke the file (as mentioned above) all correspond to slightly different ways of using this simple new Unix utility. For example, when invoked with two command-line arguments, the program should read from the input file the user supplies and write the reversed version of said file to the output file the user supplies.