LearnPy Hub
← File Handling problems
Medium

Sort a File

Read n lines and write them to data.txt. Then read the file, write its lines in alphabetical order to sorted.txt and print sorted.txt.

Input

n, then n lines.

Output

n lines.

Sample 1

Input
3
pear
apple
fig
Output
apple
fig
pear

Sample 2

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