Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Python 3.5 This is my Student Class: https://pastebin.com/rgFJFvv8 It is saved as Student.py in the same directory as all the files. This is my other

Python 3.5

This is my Student Class: https://pastebin.com/rgFJFvv8 It is saved as Student.py in the same directory as all the files.

This is my other python file: https://pastebin.com/KPuq1j1L

It is saved as A1.py in the same directory as Student.py

Need help completing read_classlist()

You are required to complete the read_classlist() function which returns a list of Student objects. If the second option of the menu, i.e., Read a ClassList, is selected, 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. 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.

Here's a sample running of this section with an invalid filename:

Enter your choice: 2 --------------------------------------------------- Enter name of the classlist file: out.txt File out.txt could not be opened --------------------------------------------------- ... 6. Quit the program --------------------------------------------------- Enter your choice

Here's a sample running of this section with a valid filename:

Enter your choice: 2 --------------------------------------------------- Enter name of the classlist file: classlist.txt 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: [] --------------------------------------------------- ... 6. Quit the program --------------------------------------------------- Enter your choice: :

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

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Microsoft SQL Server 2012 Unleashed

Authors: Ray Rankins, Paul Bertucci

1st Edition

0133408507, 9780133408508

More Books

Students also viewed these Databases questions