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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started