定义函数count_day(y,m,d),y,m,d分别是年月日,输入某年某月某日,返回这一天是这一年的第几天

def count_day(y,m,d):
    list1 = [0,31,28,31,30,31,30,31,31,30,31,30,31]
    day=0
    if (y%400==0)or(y%4==0 and y%100!=0):
        list1[2]=list1[2]+1
    for i in range(m):
            day=day+list1[i]
    return ("%d年%d月%d日是这一年的第%d天"%(y,m,d,day+d))

你可能感兴趣的:(Python,python)