python2 exercises - writing function, enter the year, to determine whether it is a leap year

Gregorian calendar is a leap year term. Leap year and leap year is divided into ordinary century leap years.
Common leap: calendar year is a multiple of 4, and is not a multiple of 100, for the general leap year. (Such as 2004 is a leap year);
century leap year: calendar year is the 100th number, must be a multiple of 400 is the century leap year (such as 1900 is not a leap year century, the year 2000 is a leap year century);
leap year (Leap Year) to the number of days to make up for the year due to human caused by the difference between the calendar specified time period of revolution of the Earth actually established. Make up the difference between the time the year is a leap year. A total of 366 days a leap year (January to December are 31 days, 29 days, 31 days, 30 days, 31 days, 30 days, 31 days, 31 days, 30 days, 31 days, 30 days, 31 days).
Where there is a leap day in the Gregorian calendar (to February 29) year; EPACT (Suiyu intercalation lunar calendar year compared with the poor return in time.); Note leap year (Gregorian calendar nouns) and leap month ( Lunar nouns) and is not directly related, the Gregorian calendar leap year only points of peace, year has 365 days and a leap year has 366 days (mid-February one more day); leap month average year may have (such as 2017 is leap year, the lunar calendar there are a leap month, leap in June).

code show as below:

def Chaxun(year):
    year = int(year)
    if year % 400 == 0:
        print('%d是世纪闰年' %year)
    elif year % 4 == 0 and year % 100 != 0:
        print('%d是普通闰年' %year)
    else:
        print('%d不是闰年' %year)
print Chaxun(2000)

Output effect
Here Insert Picture Description

We published 118 original articles · won praise 1402 · Views 210,000 +

Guess you like

Origin blog.csdn.net/weixin_45728976/article/details/105402994