Skip to content

Instantly share code, notes, and snippets.

@ajeebkp23
Created December 20, 2023 05:04
Show Gist options
  • Save ajeebkp23/63ec4c291cc62a7363f858ba5ee359f9 to your computer and use it in GitHub Desktop.
Save ajeebkp23/63ec4c291cc62a7363f858ba5ee359f9 to your computer and use it in GitHub Desktop.
Boring Birthdays
#!/usr/bin/env python3
import sys
from datetime import datetime
#print(len(sys.argv))
if len(sys.argv) == 4:
birthday = " ".join(sys.argv[1:4])
elif len(sys.argv) == 3:
birthday = " ".join(sys.argv[1:3]) + " x"
elif len(sys.argv) == 1:
print(
"Enter your Birthday in dd mmm X format. where dd is 2 digit date, mmm is 3 digit month like dec/jan/etc, X is simply x or X - a place holder"
)
birthday = input()
else:
birthday = sys.argv[1]
birthday_date = datetime.strptime(birthday, "%d %b X")
today = datetime.now()
if today.day == birthday_date.day and today.month == birthday_date.month:
print("Today is your birthday!")
else:
print("Today is not your birthday.")
@ajeebkp23
Copy link
Author

How to run this

python boring_birthdays.py
python boring_birthdays.py 1 jan
python boring_birthdays.py 1 jan x
python boring_birthdays.py 1 jan x

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment