Question: In python, please include comments and output Test case: Write a program that reads each line in a file, reverses its lines, and writes them

In python, please include comments and output
Test case:

Write a program that reads each line in a file, reverses its lines, and writes them to another file. For example, if the file input.txt contains the lines Mary had a little lamb Its fleece was white as snow And everywhere that Mary went The lamb was sure to go. and you run: reverse input.txt output.txt then output.txt contains The lamb was sure to go. And everywhere that Mary went Its fleece was white as snow Mary had a little lamb man Sometimes it's hard to be a woman Givin' all your love to just one man You'll have bad times, and he'll have good times Doin' things that you don't understand But if you love him, you'll forgive him Even though he's hard to understand And if you love him, oh be proud of him 'Cause after all, he's just a Stand by your man Give him two arms to cling to And somethin' warm to come to When nights are cold and lonely Stand by your man And show the world you love him Keep givin' all the love you can Stand by your man Stand by your man And show the world you love him Keep givin' all the love you can Stand by your man
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
