CJCoding With Joseph
15free / daySign inCreate account

Growing To-Do File

Create todo.txt in write mode holding first_task on its own line, then read two more tasks from input and add each one to the file in append mode, opening the file in mode "a" for each. Finally read the file back and print every task on its own line as <number>. <task> counting from 1, trimming the newline with rstrip. Input: two lines, one task each, no prompt.

Expected Output:

1. buy milk
2. call Sam
3. walk the dog

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

Hints3 available
Topics:
Files
📥 Auto-Input:
call Sam\nwalk the dog\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.