1 days = 0 2 months = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31] 3 year = int(input('请输入年份,如2004:')) 4 month = int(input('请输入月份,如12:')) 5 day = int(input('请输入日,如1:')) 6 if (year % 4 == 0 and year % 100 != 0) or year % 400 == 0: 7 months[1] = 29 8 for i in range(month - 1): 9 days = days + months[i] 10 days = days + day 11 print('%s年%s月%s日是这一年的第%s天' % (year, month, day, days))