Created
June 18, 2023 01:25
-
-
Save danishi/96be4ca21a0ed63190a3aa6974234985 to your computer and use it in GitHub Desktop.
Year Progress
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
| import datetime | |
| today = datetime.date.today() | |
| #today = datetime.date(2023, 12, 31) # for testing | |
| year_start = datetime.date(today.year, 1, 1) | |
| year_end = datetime.date(today.year + 1, 1, 1) | |
| year_progress = (today - year_start) / (year_end - year_start) | |
| persent = str(round(year_progress * 100)) + '%' | |
| progress_bar = '▓' * round(year_progress * 15) + '░' * (15 - round(year_progress * 15)) # 15 bars | |
| print(progress_bar + ' ' + persent) |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Inspired by https://twitter.com/year_progress