Question: 7 . 3 5 LAB: Reverse lines in a file Write a PYTHON program that reads each line in a file, reverses its lines, and

7.35 LAB: Reverse lines in a file
Write a PYTHON program that reads each line in a file, reverses its lines, and writes them to another file.
Ex: In the file input. txt contains the lines:
Mary had a little lamb
Whose fleece was white as snow.
And everywhere that Mary went,
The lamb was sure to go!
then output. txt contains:
The lamb was sure to go!
And everywhere that Mary went,
Whose fleece was white as snow.
Mary had a little lamb
A run of the program is:
Enter input file name: mary.txt
Enter output file name: output.txt
Unit tests will be provided for testing and comments are included in the template to guide you. You do not need to include any print
statements for the output.
537576.3921424.qx3zqy7
##
# Copy the lines from one file into another so that they are in reverse
# order.
#
# Read the input file name from the command line and open the input file
# Read the lines from the input file
# Close the input file
# Read the output file name from the command line and open the output file.
Run your program as often as you'd like, before submitting for grading. Below, type any needed
inputvalues in the first box. then click Run proaram and observe the program's output in the
 7.35 LAB: Reverse lines in a file Write a PYTHON program

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!