LearnPy Hub
← File Handling problems
Medium

Reverse a File

Write n lines to a.txt. Then write them in reverse order to b.txt and print b.txt.

Input

n, then n lines.

Output

n lines.

Sample 1

Input
3
1
2
3
Output
3
2
1

Sample 2

Input
1
only
Output
only
solution.py
Output appears here
Reverse a File · Python practice problem · LearnPy Hub