Question: load_students(filename) This function will open filename, which is a csv file containing student information (name,id) on each line. This function will create a new student
load_students(filename)
This function will open filename, which is a csv file containing student information (name,id) on each line. This function will create a new student object for every entry in the file, add it to a list and then return the list of students. You are NOT to use a CSV module to do this.
write_students_to_file(student_list, filename)
This function will open the file filename and output a record into this file for every student object in student_list. These records will have the same format as the sample student input data provided (name,id on each line).
sort_students_by_id(student_list)
In this function you will implement the selection sort algorithm that was presented in class. This algorithm will sort the student list based on ID number (i.e. smaller IDs come before larger IDs) and will return this sorted list.
search_student_by_id(student_list, target_id)
In this function you will implement the binary search algorithm. This will search the list of students (student_list), looking for the student whose id == target_id. You will return the index of this student in the list. If there is no student with id == target_id, you will return -1. A precondition of using this function is that student_list is sorted. If you cannot get your sorting function to work, use the sorted sample data and skip the sorting step as the student list will have to be sorted by student ID to use this function.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
