Last active
December 19, 2024 14:36
-
-
Save gabrielmontagne/db946bbf0c2bf53cdeb89ba3d121446b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import datetime | |
from dateutil.relativedelta import relativedelta | |
def generate_life_calendar(birthday, total_years=80): | |
today = datetime.date.today() | |
print(" TODAS HIEREN, LA ÚLTIMA MATA") | |
print("") | |
for age in range(1, total_years + 1): | |
start_of_year = birthday + relativedelta(years=age - 1) | |
row_label = f"{age:2d} [{start_of_year.year}] " | |
week_str = "" | |
for week_idx in range(52): | |
week_date = start_of_year + datetime.timedelta(weeks=week_idx) | |
if week_date <= today: | |
week_str += "█" | |
else: | |
week_str += "░" | |
print(row_label + week_str) | |
if __name__ == "__main__": | |
birthday = datetime.date(1976, 6, 15) | |
generate_life_calendar(birthday, total_years=80) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment