~fkfd/sections

eed10145e5fad61e56df634903dba0eb8f76e03b — Frederick Yin 1 year, 6 months ago b782885
Use any() to check conflict in resolve()
1 files changed, 9 insertions(+), 9 deletions(-)

M main.py
M main.py => main.py +9 -9
@@ 54,15 54,15 @@ def section_choices(courses: dict):

def resolve(courses: dict):
    for choice in section_choices(courses):
        confl = False
        for course1, course2 in combinations(choice, 2):
            if conflict(
                courses[course1[0]]["sections"][course1[1]],
                courses[course2[0]]["sections"][course2[1]],
            ):
                confl = True
                break
        if not confl:
        if not any(
            [
                conflict(
                    courses[course1[0]]["sections"][course1[1]],
                    courses[course2[0]]["sections"][course2[1]],
                )
                for course1, course2 in combinations(choice, 2)
            ]
        ):
            print_timetable(courses, choice)
            print()