×
For the first part of this exercise assume you have a file called students.txt
which simply contains a bunch of student names, one name per line. Your goal is to write two functions:
add_student
- accepts a parameter of first_name
and writes to a file called students.txt
. find_student
- accepts a parameter of first_name
and returns the first student foundupdate_student
- accepts a parameter of first_name
and new_name
and updates first student foundremove_student
- accepts a parameter of first_name
and removes the student from the text fileFor the next part of this exercise, you will be working with CSVs, so first create a file called users.csv
and then work on the following two functions:
users.csv
fileusers.csv
file. For solutions to these exercises, click here.
When you're ready, move on to Generators and Iterators