Пример #1
0
 def from_csv(first_name, last_name, promoted, grades_value):
     student = Student(first_name, last_name)
     student.promoted = promoted
     student._final_grades = [
         Grade(value=grade_value) for grade_value in grades_value
     ]
     return student
Пример #2
0
 def add_final_grade(self, grade, check_promotion_policy=None):
     if check_promotion_policy is None:
         check_promotion_policy = GradeCalculator.normal_promotion_policy
     self._final_grades.append(Grade(value=grade))
     if check_promotion_policy(self._final_grades):
         self.promoted = True
     else:
         self.promoted = False
Пример #3
0
def run_example():
    best_grade = Grade(value=6)
    failing_grade = Grade(value=1)
    print(best_grade)
    print(failing_grade)
    print(best_grade.is_passing())
    print(failing_grade.is_passing())
Пример #4
0
    def add_final_grade(self,
                        grade,
                        subject=None,
                        check_promotion_policy=None):
        if check_promotion_policy is None:
            check_promotion_policy = GradeCalculator.normal_promotion_policy
        if subject:
            final_grade = FinalGrade(value=grade, subject=subject)
        else:
            final_grade = Grade(value=grade)
        self._final_grades.append(final_grade)

        if check_promotion_policy(self._final_grades):
            self.promoted = True
        else:
            self.promoted = False
Пример #5
0
def run():
    best_grade = Grade(6)
    failing_grade = Grade(1)
    print(best_grade)
    print(failing_grade)
    print(best_grade.is_passing())
    print(failing_grade.is_passing())

    math = Subject(identifier=1, name="Matematyka", is_obligatory=True)
    # math = Subject(2, "WF", True)
    # print(math)

    # final_grade = FinalGrade(value=3, subject="WF")
    final_grade = FinalGrade(value=3, subject=math)
    print(final_grade)
    print(final_grade.is_passing())

    math.assign_teacher("Mariusz")
    math.assign_teacher("Adam")
    print(math)
Пример #6
0
 def add_final_grade(self, grade):
     self._final_grades.append(Grade(value=grade))
     if not grade.is_passing():
         self.promoted = False
Пример #7
0
 def add_final_grade(self, grade):
     self._final_grades.append(Grade(value=grade))
     if not self.check_promotion():
         self.promoted = False
     else:
         self.promoted = True
Пример #8
0
 def add_final_grade(self, grade):
     self.final_grades.append(Grade(value=grade))
     if grade == 1:
         self.promoted = False
Пример #9
0
def run_example():
    best_grade = Grade(value=6)
    print(best_grade)
    best_grade.value = 1
    print(best_grade.is_passing())