From fb720f5ad5f5e31fc3b9115cb5fe15ecc28208ed Mon Sep 17 00:00:00 2001 From: MstrPikachu <31784486+MstrPikachu@users.noreply.github.com> Date: Sun, 3 Oct 2021 16:12:37 -0400 Subject: [PATCH] Finish 3b --- assignments/a2/a2_part3.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/assignments/a2/a2_part3.py b/assignments/a2/a2_part3.py index 8c3b12a..562e7b3 100644 --- a/assignments/a2/a2_part3.py +++ b/assignments/a2/a2_part3.py @@ -248,7 +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] + return all([not sections_conflict(section, s) for s in schedule.values]) def is_course_compatible(schedule: dict[str, tuple[str, str, tuple]], @@ -264,6 +264,7 @@ def is_course_compatible(schedule: dict[str, tuple[str, str, tuple]], - schedule matches the format for a schedule described by the assignment handout. - course[0] not in schedule """ + return any([is_section_compatible(section, schedule) for section in course[2]]) def compatible_sections(schedule: dict[str, tuple[str, str, tuple]], @@ -279,6 +280,7 @@ def compatible_sections(schedule: dict[str, tuple[str, str, tuple]], - schedule matches the format for a schedule described by the assignment handout. - course[0] not in schedule """ + return {section for section in course[2] if is_section_compatible(schedule, section)} if __name__ == '__main__':