From 3bdcc7e36d22a971ce8dddeae52f729e943c7c87 Mon Sep 17 00:00:00 2001 From: MstrPikachu <31784486+MstrPikachu@users.noreply.github.com> Date: Sun, 3 Oct 2021 16:05:00 -0400 Subject: [PATCH] Finish get_valid_courses --- assignments/a2/a2_part3.py | 1 + assignments/a2/a2_part4.py | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/assignments/a2/a2_part3.py b/assignments/a2/a2_part3.py index 0115a7f..8c3b12a 100644 --- a/assignments/a2/a2_part3.py +++ b/assignments/a2/a2_part3.py @@ -248,6 +248,7 @@ def is_section_compatible(schedule: dict[str, tuple[str, str, tuple]], - section matches the format for a section described by the assignment handout. - schedule matches the format for a schedule described by the assignment handout. """ + return [not sections_conflict(section, s) for s in schedule.values] def is_course_compatible(schedule: dict[str, tuple[str, str, tuple]], diff --git a/assignments/a2/a2_part4.py b/assignments/a2/a2_part4.py index fa0503a..418ca7a 100644 --- a/assignments/a2/a2_part4.py +++ b/assignments/a2/a2_part4.py @@ -124,7 +124,9 @@ def get_valid_schedules(course_data: dict[str, tuple[str, str, set]], 2. You'll need to process each course to filter to keep only the sections that appear in the given term. See the function we've started for you below. """ - # TODO + valid_courses = [course_data[code] for code in course_data if code in courses] + a, b, c, d, e = [filter_by_term(course, term) for course in valid_courses] + return a2_part3.valid_five_course_schedules(a, b, c, d, e) def filter_by_term(course: tuple[str, str, set], term: str) -> tuple[str, str, set]: