CJCoding With Joseph
15free / daySign inCreate account

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
Topics:
FilesSlicing
📥 Auto-Input:
abc\nhello\nx\n
This input is automatically fed to your program's stdin
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.