CJCoding With Joseph
15free / daySign inCreate account

Write Then Read Back

Read one line from standard input and write it to greeting.txt with a newline after it (that part is written for you). Then open the file again in read mode, read everything with f.read() into text and print it exactly as it came back, using end="" so the newline stored in the file is the only one printed. Input: one line, no prompt.

Expected Output:

Hello, file!

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

Hints3 available
Topics:
Files
📥 Auto-Input:
Hello, file!\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.