程序如下:
year = int(input("请输入四位数年份:"))
month = int(input("请输入月份:"))
if year % 4 == 0 and year % 100 != 0 or year % 400 == 0:
print(year,'年','是闰年有366天')
else:
print(year,'年','是平年有365天')
if month in (1,3,5,7,8,10,12):
print(month,'年','是大月有31天')
if month in (4,6,9,11):
print(month,'年','是小月有30天')
elif month==2:
if year % 4 == 0 and year % 100 != 0 or year % 400 == 0:
print(year,'年',month,'月','有29天是闰月')
else:
print(year,'年',month,'月','有28天是平月')
结果例: