Data Science, Python, Planning, Vacation, Algorithms.
timedelta(days=1) start -= timedelta(days=start.weekday() + 1) while end.weekday() < 5 or (end + timedelta(days=1)) in public_holidays: end += timedelta(days=1) end += timedelta(days=6 - end.weekday()) # Check for overlapping or adjacent breaks if extended_breaks and extended_breaks[-1][1] +