Question: OBJECTIVE You will use your knowledge of functions OBJECTIVE You will use your knowledge of functions and lists to write a Python program that allows

OBJECTIVE
You will use your knowledge of functions OBJECTIVE
You will use your knowledge of functions and lists to write a Python program that allows the user to manipulate the information from a student list.
THE PROBLEM
Assuming that we have the student list below (the information for each student is stored in the following order: ID (integer), First name (string), Last name (string), Major (string), and GPA (float)):
[[123456, 'Fname1', 'Lname1', 'Major1',4.0],[123457, 'Fname2', 'Lname2', 'Major2',3.5],[123458, 'Fname3', 'Lname3', 'Major3',3.0],[123459, 'Fname4', 'Lname4', 'Major4',2.5]]
And, given the Python program provided in the template file, you must:
1) Write the definition and implementation of the following user-defined functions (in the myModule.py file):
printMenu (provided in the template file - DO NOT MODIFY THIS FUNCTION): This function does not receive any parameters and does not return a value. The function prints to STDOUT the following output messages:
1. Add Student
2. Delete Student
3. Modify Student
4. Print Student List
5. Print Class Average
6. Exit
readStudentInfo (provided in the template file - DO NOT MODIFY THIS FUNCTION): This function receives the ID of the student (integer) as a parameter, reads from STDIN the student information (first name, last name, major, and GPA), and returns a list with the student's information [id, first name, last name, major, GPA].
findStudentInList: This function receives the ID of the student to find in the list (integer) and the list of students (list of lists) as parameters and returns an integer value with the position of the student in the list (if the ID is not in the list of students, the function returns -1).
addStudent: This function receives the ID of the student to be added (integer) and the list of students (list of lists) as parameters and returns a boolean value (True if the new student is added to the list or False otherwise). The function must request the information about the new student using the readStudentInfo function (provided in the template file) only if the student is not on the list (you must use the findStudentInList function). Finally, if the student is not on the list, the function appends the new student at the end of the list.
deleteStudent: This function receives the ID of the student to be deleted (integer) and the list of students (list of lists) as parameters and returns a boolean value (True if the student is deleted from the list or False otherwise).
modifyStudent: This function receives the ID of the student to be modified (integer) and the list of students (list of lists) as parameters and returns a boolean value (True if the student is on the list or False otherwise). The function does not allow the user to change the student ID. You must use the readStudentInfo function (provided in the template file) to read the new information from STDIN only if the selected student is on the list (use the findStudentInList function).
printStudentList: This function receives the list with the student (list of lists) and does not return a value. Given the list of lists above, the function prints to STDOUT contents of the list of students using the following output messages:
Student # 1: ID: 123456, First name: Fname1, Last name: Lname1, Major: Major1, GPA: 4.00
Student # 2: ID: 123457, First name: Fname2, Last name: Lname2, Major: Major2, GPA: 3.50
Student # 3: ID: 123458, First name: Fname3, Last name: Lname3, Major: Major3, GPA: 3.00
Student # 4: ID: 123459, First name: Fname4, Last name: Lname4, Major: Major4, GPA: 2.50
calculateClassGPA: This function receives the list of students (list of lists) as a parameter and returns a float value with the average GPA for the students in the list.
2) Modify the PA4.py file to call the user-defined functions implemented in the myModule.py file (you only need to modify the provided code based on the comments in the template file).
EXAMPLE:
1. Add Student
2. Delete Student
3. Modify Student
4. Print Student List
5. Print Class Average
6. Exit
Enter your option: 1
Enter the ID of the student to be added: 123456
Enter the First Name: Carlos
Enter the Last Name: Rincon
Enter the Major: CS
Enter the GPA: 4
Student 123456 added to the list
1. Add Student
2. Delete Student
3. Modify Student
4. Print Student List
5. Print Class Average
6. Exit
Enter your option: 1
Enter the ID of the student to be added: 123457
Enter the First Name: Laura
Enter the Last Name: Castro
Enter the Major: CHEM
Enter the GPA: 3.42
Student 123457 added to the list
1. Add Student
2. Delete Student
3. Modify Student
4. Print Student List
5. Print Class Average
6. Exit
Enter your option: 1
Enter the ID of the student to be added: 123458
Enter the First Name: Veronica
Enter the Last Name: Rincon
Enter the Major: ENG
Enter the GPA: 3.75
Student 123458 added to the list
1. Add Student
2. Delete Student
3. Modify Student
4. Print Student List
5. Print Class Average
6. Exit
Enter your option: 6
OBJECTIVE You will use your knowledge of

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!