listing the studentreport py program produces student report from data extracted from an external source from studentfile import studentfilereader name of the file to open file_name "students txtdef main()extract the student records from the given text file reader studentfilereaderfile_name reader open(studentlist reader fetchall(reader close(sort the list by id number each object is passed to the lambda expression which returns the idnum field of the object studentlist sortkey lambda recrec idnum print the student report printreportstudentlist prints the student report def printreportthelist )the class names associated with the class codes classnames none"freshman""sophomore""junior""seniorprint the header print"list of studentscenter( print"print"%- %- %- %- ('id''name''class''gpaprint"% % % % ('- '- '- '- )print the body for record in thelist print"% %- %- % (record idnumrecord lastname 'record firstnameclassnames[record classcode]record gpaadd footer print"- print"number of students:"len(thelistexecutes the main routine main(sorted in ascending order based on the student identification number the actual report is produced by passing the sorted list to the printreport(function storage class when the data for an individual student is extracted from the input fileit will need to be saved in storage object that can be added to list in order to first sort and then print the records we could use tuples to store the recordsbut we