177. Fix the Python Program That Never Closes Its File
Easywith
Overview
A file that isn't closed may not be saved yet. with closes it for you.
Problem Statement
The program in the editor should save a note in notes.txt and then print it back. Instead, it prints only:
Saved note:
The note was written, but the file was never closed, so the reader finds it empty. Fix the program with with open(...) as f:, so every file is closed automatically. The output should be Saved note: followed by the note.
The program uses input() with no prompt text: the tests type the input for you, and a prompt would end up in your output.
Input
One line: the note. Example:
Call Rocky at 5
Output
The output for that example:
Saved note: Call Rocky at 5
The tests try 3 different notes.