Page 1 of 1

Must be solved in Python.

Posted: Fri Jul 01, 2022 5:53 am
by answerhappygod
Must be solved in Python.
Must Be Solved In Python 1
Must Be Solved In Python 1 (78.53 KiB) Viewed 44 times
Problem: Implement a special singly linked list class named 'StudentSinglyLinkedList'. The name of the nodes of this linked list should be 'Student'. Each node will have two data values (Name and CGPA) and one pointer (next). Implement following functions in this class: 1. insert_student(self, new_name, new_CGPA): This will add a Student node to the last of the list. 2. show_last_student (self): This function will display the name and CGPA of the last student in the list. 3. sort student(self): This function will print a sorted list based on the name of the students alphabetically. 4. calculate_avg_CGPA(self): This function will calculate the average CGPA of all the customers. Remember, this is a singly linked list. All the functions will have to be based on singly linked list. Also, you have to add comments before each function in your code. The comment section will explain the steps/process of the functions you have implemented. Example Hints: โ— โ— ยท 0-0-0-0-- N.B: Rahim โ— You have to add these students using 'insert_student' function. Output of 'show_last_student ()' will be=> Nafis, 3.85. Output of 'sort student()' will be=> Jamal, Karim, Nafis, Rahim. Output of 'calculate_avg_CGPA()' will be=> 3.575. Karim Jamal Nafis None 1. You have to add comments to each function explaining how you implement the function.