Program to calculate the number of odd days in given number of years | Function to return the count of odd days ; Count of years divisible by 100 and 400 ; Every 4 th year is a leap year ; Every 100 th year is divisible by 4 but is not a leap year ; Every 400 th year is divisible by 100 but is a leap year ; Total number of extra days ; modulo ( 7 ) for final answer ; Number of days
def oddDays ( N ) : NEW_LINE INDENT hund1 = N // 100 NEW_LINE hund4 = N // 400 NEW_LINE leap = N >> 2 NEW_LINE ordd = N - leap NEW_LINE if ( hund1 ) : NEW_LINE INDENT ordd += hund1 NEW_LINE leap -= hund1 NEW_LINE DEDENT if ( hund4 ) : NEW_LINE INDENT ordd -= hund4 NEW_LINE leap += hund4 NEW_LINE DEDENT days = ordd + leap * 2 NEW_LINE odd = days % 7 NEW_LINE return odd NEW_LINE DEDENT N = 100 NEW_LINE print ( oddDays ( N ) ) NEW_LINE