
Need more help with file handling?
In the modify tasks, you are given some starter code.
Use the instructions below to make changes to the code.
Comment your changes to explain what you have done.
Adapt the code so that:
- It gets input for the student’s grade.
- It concatenates the grade data to the line that is appended to the file.
- It validates the user’s choice so that it only accepts ‘yes’ or ‘no’.
Help! My code doesn’t work
Make sure that you check for the following things:
- Include the file extension (
.txt
) in the file name
- Use the exact same file variable with
open
and in the loop.
- Use exactly the same case in the filename.
- Indenting all the code that should be inside loops.
- Close the file once task is completed.