I am working on something to automatically get the last day of class, depending on the first day and days of school.
I am struggling to find a way to skip off days and automatically add +1 day to have the correct end date. Also of course, if last day falls on a week-end, it should continue until it falls on a weekday.
Here's my code so far :
start_date = datetime.date(2019, 9, 30)
number_of_days = 5
date_list = []
for day in range(number_of_days):
a_date = (start_date + datetime.timedelta(days = day)).isoformat()
date_list.append(a_date)
print(date_list[-1])
I was thinking of putting all of my off days in a separate list, and iterate on it, but I cant find a way to add +1 in datetime. Also, creating a list of date seems difficult, as you can't iterate on dates?