Names sorted into a file
Task
Each line of the file mena.txt holds one name. The program sorts the names alphabetically (with sorted), prints them - each on its own line - and also writes them in the same order to a new file zoradene.txt, again one per line.
Open the files with a with block - it makes sure the writing really finishes.
Examples
Call
print("---") with open("zoradene.txt", encoding="utf-8") as _f: print(_f.read(), end="")Expected output
Adam Eva Marek Zuzana --- Adam Eva Marek Zuzana
After you submit, 3 hidden tests will also check your solution: one name, the last name without a newline, already sorted.
Python starts the first time you run code.
Ctrl+Enter runs the program. Tab indents. Press Esc, then Tab, to leave the editor.
Input (stdin)
Each line = one call to input().
Output
Hints
Try it yourself first. Each hint reveals a little more - and lowers the reward a little.
Signed out, hints are free - but no XP is awarded either.
Solution
The solution unlocks after the last hint.