Skip to content

Instantly share code, notes, and snippets.

@carlynorama
Last active May 31, 2018 03:05
Show Gist options
  • Save carlynorama/d2ffde339f6749d8cb09e7179a44a825 to your computer and use it in GitHub Desktop.
Save carlynorama/d2ffde339f6749d8cb09e7179a44a825 to your computer and use it in GitHub Desktop.
check if any date is a Tuesday
import datetime
import dateutil.parser #dateutil module
date = datetime.datetime.today()
def is_it_tuesday(date_to_check):
if date_to_check.weekday() == 1:
print("yes")
else:
print("no")
if __name__ == "__main__":
raw_date_string = input('What day do you want to check? ')
checkme = dateutil.parser.parse(raw_date_string)
is_it_tuesday(checkme)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment