其他分享
首页 > 其他分享> > 求各位大佬们帮我看看哪里错了

求各位大佬们帮我看看哪里错了

作者:互联网

x=input()
    year,mon,day=map(int,x.split())
    if year % 4 == 0 and year % 400 != 0:
        def day_run_year(year, mon, day):
        """定义闰年的月份,并返回总天数"""
        sum_day = day
        day_month = [0, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]
        for i in day_month[0:mon]:
            sum_day = sum_day + i
        return sum_day
        
        def day_ping_year(year, mon, day):
        """定义平年每月是多少天,并返回总天数"""
        sum_day = day
        day_month = [0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]
        for i in day_month[0:mon]:
            sum_day = sum_day + i
        return sum_day
    
    # 调用函数,输出总天数
    if run_year:
        print(day_run_year(year, mon, day))
    else:
        print(day_ping_year(year, mon, day))
 

标签:各位,sum,31,30,哪里,mon,year,大佬,day
来源: https://blog.csdn.net/gangan112233/article/details/120594923