Skip to content

Instantly share code, notes, and snippets.

@mozammel
Created September 5, 2024 14:49
Show Gist options
  • Save mozammel/f379de6998c4453be598b3ceaee694c6 to your computer and use it in GitHub Desktop.
Save mozammel/f379de6998c4453be598b3ceaee694c6 to your computer and use it in GitHub Desktop.
from datetime import datetime
from dateutil import relativedelta
# Assign your birth date and average life expectancy
birth_date = input("Enter your birth date (YYYY-MM-DD): ")
birth = datetime.strptime(birth_date, "%Y-%m-%d")
avg_life = 72
current = datetime.now()
r = relativedelta.relativedelta(current, birth)
years_elapsed = r.years
months_elapsed = r.months
total_months_elapsed = (r.years * 12) + r.months
print()
print("\t\t Today: ", current.strftime("%Y-%m-%d"), "\n")
print(" ", end="")
for i in range(1, (12 * avg_life) + 1):
if i <= total_months_elapsed:
print("x", end="")
else:
print(".", end="")
if i % 48 == 0:
print()
if i % 12 == 0:
print(" ", end="")
print()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment