Created
December 4, 2019 15:32
-
-
Save mlazzarotto/2b9e7d70a5d7b45c5e7575322d141802 to your computer and use it in GitHub Desktop.
This file contains 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 calendar | |
def compare_calendar(curr_year, min_year, max_year): | |
if (curr_year >= min_year) and (curr_year <= max_year): | |
c = calendar.TextCalendar(calendar.MONDAY) | |
c_curr_year = c.formatyear(curr_year) | |
c_curr_year = c_curr_year[42:] | |
print('Current year is {}'.format(curr_year)) | |
for y in range(min_year, max_year+1): | |
c_y = c.formatyear(y) | |
c_y = c_y[42:] | |
if c_curr_year == c_y: | |
print('2019 == {}'.format(y)) | |
else: | |
print('Something\'s wrong') | |
curr_year = int(input('Insert the year you want to check: ')) | |
min_year = int(input('Insert the minimum year to check: ')) | |
max_year = int(input('Insert the maximum year to check: ')) | |
compare_calendar(curr_year, min_year, max_year) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment