← Back to Files
Question 435
Reversed Copy
Reversed Copy
Input: three lines, no prompt. Write them to forward.txt, read that file into a list with readlines, and write each line reversed (remove its newline with rstrip, then use the slice [::-1]) to backward.txt, one per line in the same order. Finally read backward.txt with for line in f, print each line without its newline and then <n> lines reversed with the number of lines read.
Expected Output:
cba olleh x 3 lines reversed
= newline. The output ends with a newline — print one after the last line.
Hints4 available
Sign in to use hintsTopics:
FilesSlicing
1
Tab to indent (Esc then Tab to move on) · Ctrl+Enter to run · Ctrl+Space to expand shortcuts (pr, inp, def)
Your Output
Run your code to see the output here...
Test Cases
Run your code to see test case results.