Skip to content

Instantly share code, notes, and snippets.

@mlazzarotto
Created December 4, 2019 15:32
Show Gist options
  • Save mlazzarotto/2b9e7d70a5d7b45c5e7575322d141802 to your computer and use it in GitHub Desktop.
Save mlazzarotto/2b9e7d70a5d7b45c5e7575322d141802 to your computer and use it in GitHub Desktop.
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