Question: PYTHON 3.5 classlist.txt contains a class list of the course in the following format: John,N00000001,john@amail.com Kelly,N00000002,kelly@bmail.com Nicky,N00000003,nicky@cmail.com Sam,N00000004,sam@dmail.com Adam,N00000005,adam@amail.com You are required to complete the

PYTHON 3.5

classlist.txt contains a class list of the course in the following format: John,N00000001,john@amail.com Kelly,N00000002,kelly@bmail.com Nicky,N00000003,nicky@cmail.com Sam,N00000004,sam@dmail.com Adam,N00000005,adam@amail.com

You are required to complete the read_classlist() function which returns a list of Student objects. The program should allow the user to type in a file name for reading a class list. If the file exists you can print out a confirmation message. If the file doesn't exist you should tell the user that the file cannot be found and display the main menu again. Function for main menu is display_menu()

Note that the function should also print the list of students for our marking purpose. You may use the String data type's split() method to split apart the data from the file. You will need to think about the order in which you need to split your items. For example, your file is organized so that one student's record occupies an entire line in the file. Splitting first on the line break will isolate each student's data. (You may want to use the splitlines() method from the String class. This method returns a list of the lines in the string, breaking at line boundaries and line breaks are not included in the resulting list.) Then you will need to further split each item based on the separator character to pull out the name, id and email address.

Test Input Result
read_classlist() input.txt Enter name of the classlist file: File input.txt could not be opened
read_classlist() classlist.txt

Enter name of the classlist file: Completed reading of file classlist.txt

N00000001: John, john@amail.com, marks: [] N00000002: Kelly, kelly@bmail.com, marks: [] N00000003: Nicky, nicky@cmail.com, marks: [] N00000004: Sam, sam@dmail.com, marks: [] N00000005: Adam, adam@amail.com, marks: []

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 Databases Questions!