I stumbled across the #100DaysofCode challenge. I signed up for the Talk Python #100DaysofCode in Python course which is a collaboration between the guys from Pybites and Michael Kennedy. The first set of lessons focused on the datetime module. In the course, we were supposed to use the datetime module to create a pomodoro timer. Instead, I decided to create a countdown to summer break timer.
I plan to make this one of the first projects for next school year. I might even team up with the makerspace teacher and create an LED sign that displays the countdown. To be real, I’m just trying to make it through this school year.
"""A countdown timer until the end of the school year."""
from datetime import datetime
import numpy as np
import time
LAST_DAY_OF_SCHOOL = datetime(2025, 6, 13, 1, 35)
HOLIDAYS = [
]
SCHOOL_YEAR = "2023-2024"def countdown():
print("\tTime until school is out for summer {SCHOOL_YEAR.split("-")[-1]}:", end="\n\n")
event_delta = LAST_DAY_OF_SCHOOL - datetime.now()
while (event_delta.days + event_delta.seconds) > 0:
hours, remaining_delta = divmod(event_delta.seconds, 3600)
mins, secs = divmod(remaining_delta, 60)
timer = f"\t{event_delta.days:02d} days {hours:02d} hours {mins:02d} minutes {secs:02d} seconds"
print(timer, end="\r")
time.sleep(1)
event_delta = LAST_DAY_OF_SCHOOL - datetime.now()
print("School's out for summer!")def school_days_left():
today = datetime.now()
total_minus_weekends = np.busday_count(today.date(), LAST_DAY_OF_SCHOOL.date())
remaining_holidays = 0
for holiday in HOLIDAYS_2024:
if holiday > today.date():
remaining_holidays += 1
print()
print(
f"\tThere are {total_minus_weekends - remaining_holidays} school days left in the {SCHOOL_YEAR} school year.",
end="\n\n",
)
if __name__ == "__main__":
school_days_left()
countdown()