Free video project · Beginner
Christmas countdown 🎄
Sleeps till Christmas, the day it falls on, a little advent calendar and a countdown to the rest of the holidays, all with the datetime module.
The video is out Tuesday 1 December at 6pm.
The code from the video
# Christmas countdown
from datetime import date
today = date(2026, 12, 15) # swap in date.today() for the real date
christmas = date(today.year, 12, 25)
if today > christmas:
christmas = date(today.year + 1, 12, 25)
sleeps = (christmas - today).days
print("Sleeps till Christmas:", sleeps)
print("That's", sleeps // 7, "weeks and", sleeps % 7, "days")
print("Christmas Day is a", christmas.strftime("%A"))
print()
for day in range(1, 25):
if day < today.day:
door = " X"
elif day == today.day:
door = "[" + str(day) + "]"
else:
door = f"{day:>2}"
print(f"{door:>4}", end="")
if day % 6 == 0:
print()
print()
EVENTS = [("Christmas Eve", date(2026, 12, 24)), ("Boxing Day", date(2026, 12, 26)),
("New Year's Eve", date(2026, 12, 31)), ("New Year's Day", date(2027, 1, 1))]
for name, when in EVENTS:
days = (when - today).days
print(f"{name:<16}{days:>3} days ({when.strftime('%a %d %b')})")
Run it in your browser with nothing to install, right here on this page.
Make it your own
- Count down to your own birthday as well.
- Show how many weekends are left before Christmas.
- Print the advent calendar as a 6 by 4 grid with today's door marked.
Skills: datetime, timedelta, loops, f-strings