Question: Must be done in Python Private Data Attributes 1. id: int 2. name:string 3. address:string 4. program:string 5. current_courses:[] # Contains a list of course

Must be done in Python

Private Data Attributes

1. id: int

2. name:string

3. address:string

4. program:string

5. current_courses:[] # Contains a list of course IDs

6. completed_courses:{} # Contains a mapping from CourseID to marks obtained.

Properties:

1. name (getter only)

2. id (getter only)

3. address (getter and setter)

Derived Properties

1. average_score: Returns average score of all the completed courses. Return -1 if no courses have been completed.

Methods:

1. add_course. Takes a course id and adds to the list of current courses.

2. drop_course. Removes course id from list of courses if present, otherwise raise ValueError

3. course_completed: Takes course_id and marks_obtained and stores in the completed_courses dict if course_id in current_courses list.

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!