by ouija · 4y ago · 0 comments
You could write it as a one-liner in Python as well, but I would prefer not to.
print("It's Saturday") if date.today().weekday() == 5 else None
That the Python library doesn't define constants for days is unfortunate, but not a limitation of the language. >>> import calendar
>>> calendar.SATURDAY
5One incredibly common alternative to a codebase is a script.
if date.today().weekday() == 5: print("It's Saturday")