CJCoding With Joseph
15free / daySign inCreate account

Last Line First

Three lines read from input are written to order.txt and read back into the list lines with readlines. Loop over the list backwards using the slice lines[::-1] and print each line with its newline removed by rstrip, so the file appears in reverse order. Input: three lines, no prompt.

Expected Output:

third
second
first

= newline. The output ends with a newline — print one after the last line.

Hints2 available
Topics:
FilesSlicing
📥 Auto-Input:
first\nsecond\nthird\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.