Question: identify the class definition ----------------------------------------- STUDENT ----------------------------------------- identify the constructor ----------------------------------------- DEFAULT_SCHOOL ----------------------------------------- identify a private instance variable ----------------------------------------- self._grades ----------------------------------------- identify a public instance
identify the class definition ----------------------------------------- STUDENT
----------------------------------------- identify the "constructor" ----------------------------------------- DEFAULT_SCHOOL
----------------------------------------- identify a private instance variable ----------------------------------------- self._grades
----------------------------------------- identify a public instance variable ----------------------------------------- Self._name
----------------------------------------- identify a class variable -----------------------------------------
----------------------------------------- identify a getter ----------------------------------------- name(self)
----------------------------------------- identify a setter ----------------------------------------- set_name
----------------------------------------- identify a decorator -----------------------------------------
class Student: """ Simple student representation """
DEFAULT_SCHOOL = "BCIT"
def __init__(self, name, school): self._name = name self._grades = list() if not school: school = self.DEFAULT_SCHOOL
self.school = school
def print_description(self): print(f"{self._name} ({self._school}) - GPA: {self.gpa}")
@property def name(self): return self._name def set_name(self, new_name): if not new_name: raise ValueError("Name invalid.") self._name = new_name
@property def gpa(self): return sum(self._grades)/len(self._grades)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
