Пример #1
0
def run():
    students = data_generator.generate_students(number_of_students=45)
    school = School(name="Mała szkoła", students=[])
    school.students = students
    print(school)

    student_avg = GradeCalculator.calculate_student_avg([])
Пример #2
0
def run_example():
    school = School.create_school_with_students("Hogwart")
    new_school = School.create_school_with_students("New School")

    print("school.MAX_STUDENTS_NUMBER:", school.MAX_STUDENTS_NUMBER)
    print("new_school.MAX_STUDENTS_NUMBER:", new_school.MAX_STUDENTS_NUMBER)

    print()
    print("Po modyfikacji na poziomie obiektu")
    school.MAX_STUDENTS_NUMBER = 125
    print("school.MAX_STUDENTS_NUMBER:", school.MAX_STUDENTS_NUMBER)
    print("new_school.MAX_STUDENTS_NUMBER:", new_school.MAX_STUDENTS_NUMBER)

    print()
    print("school self:")
    school.self_print_max_student_number()
    print("school cls:")
    school.cls_print_max_student_number()

    print()
    print("Po modyfikacji na poziomie klasy")
    School.MAX_STUDENTS_NUMBER = 330
    print("school.MAX_STUDENTS_NUMBER:", school.MAX_STUDENTS_NUMBER)
    print("new_school.MAX_STUDENTS_NUMBER:", new_school.MAX_STUDENTS_NUMBER)
    print("school self:")
    school.self_print_max_student_number()
    print("school cls:")
    school.cls_print_max_student_number()
    another_school = School.create_school_with_students("Other")
    print("another_school.MAX_STUDENTS_NUMBER:",
          another_school.MAX_STUDENTS_NUMBER)
Пример #3
0
def run():
    students = data_generator.generate_students()
    school = School("Moja szkoła", students)
    # print(school)
    #
    # new_students = data_generator.generate_students(8)
    # school.students = new_students
    # print(school)

    too_many_students = data_generator.generate_students(100)
    school.students = too_many_students
    print(school)
Пример #4
0
def run():
    # student = Student("Mariusz", "Baran")
    # try:
    #     print(student.grades_avg)
    # except LogicError as error:
    #     print(f"{error}")

    students = generate_students(250)
    school = School("Szkoła", [])
    try:
        school.students = students
    except PlacesLimitError as error:
        print(f"{error}")
Пример #5
0
def run_example():
    students = data_generator.generate_students()
    school = School(name="Hogwart", students=students)
    print(school)

    new_students = data_generator.generate_students(number_of_students=8)
    school.students = new_students
    print(school)

    too_many_students = data_generator.generate_students(
        number_of_students=100)
    school.students = too_many_students
    print(school)
Пример #6
0
def run_example():
    # student = Student(first_name="Bob", last_name="Bobowski")
    # try:
    #     print(student.grades_avg)
    # except LogicError as error:
    #     print(f"Błąd: {error}")

    students = data_generator.generate_students(number_of_students=250)
    school = School(name="Mała szkoła", students=[])
    try:
        school.students = students
    except PlacesLimitError as error:
        print(f"Limit miejsc wynosi: {error.places_limit}")
Пример #7
0
def run_example():
    students = data_generator.generate_students()
    school = School(name="Hogwart", students=students)
    best_student = school.best_student
    print(school)

    print(f"Średnia najlepszego ucznia: {best_student.grades_avg}")
    print(f"Oceny najlepszego ucznia: {best_student.final_grades}")
Пример #8
0
def run_example():
    students = data_generator.generate_students()

    students.sort(key=lambda student: student.grades_avg(), reverse=True)
    school = School(name="Hogwart", students=students)
    best_student = school.students[0]

    print(f"Oceny najlepszego ucznia: {best_student.final_grades}")
Пример #9
0
def run_example():
    school = School.create_school_with_students("Hogwart")
    harry = Student(first_name="Harry", last_name="Potter")
    school.assign_student(harry)
    print(school)

    new_school = school.create_school_with_students("New School")

    print(school.MAX_STUDENTS_NUMBER)
    print(new_school.MAX_STUDENTS_NUMBER)
Пример #10
0
def run_example():
    school = School.create_school_with_students("Hogwart")
    students = school.students
    for student in students:
        print(student)
    print("-" * 20)

    students.sort(key=lambda student: student.grades_avg())

    for student in students:
        print(student)
Пример #11
0
def run_example():
    school = School.create_school_with_students("Hogwart")
    students = school.students
    for student in students:
        print(student)
    print("-" * 20)

    students.sort()
    # students.sort(key=grades_avg_for_student)

    for student in students:
        print(student)
Пример #12
0
def run_example():
    school = School.create_school_with_students("Hogwart")
    students = school.students

    for student in students:
        # student.add_final_grade(1)
        student.add_final_grade(
            1, check_promotion_policy=GradeCalculator.strict_promotion_policy)

    students.sort(key=grades_avg_for_student, reverse=True)
    for student in students:
        print(student)
Пример #13
0
def run_example():
    school = School.create_school_with_students("Moja szkoła")
    students = school.students
    for student in students:
        print(student)
    print("-" * 20)

    # for student in students:
    #     student.add_final_grade(1, check_promotion_policy=GradeCalculator.normal_promotion_policy)
    # for student in students:
    #     print(student)
    # print("-" * 20)
    #
    students.sort(key=lambda student: student.grades_avg(), reverse=True)
    for student in students:
        print(student)
Пример #14
0
def run_example():
    students = data_generator.generate_students(number_of_students=45)
    school = School(name="Mała szkoła", students=[])
    school.students = students
Пример #15
0
def run_example():
    school = School.create_school_with_students("Hogwart")
    print(school)
Пример #16
0
def run():
    students = data_generator.generate_students(number_of_students=250)
    school = School(name="Mała szkoła", students=[])
    school.students = students
    print(school)
Пример #17
0
def run_example():
    students = data_generator.generate_students()
    school = School(name="Hogwart", students=students)
    print(school)
Пример #18
0
def run_example():
    school = School.create_school_with_students("Hogwart")
    print(school)

    print(f"W szkole może być maksymalnie {school.MAX_STUDENTS_NUMBER} uczniów")