python应用-传入年月日 输出为一年的第几天
ef leap_year(year): return (year//4==0 and year//100!=0) or (year //400==0) def which_day(year,month,day): total=0 days_of_month=[31,28,31,30,31,30,31,31,30,31,30,31] for index in range (month-1): total += days_of_month[index] if month >2 and leap_year(year): total += 1 return total + day if __name__ == '__main__': print(which_day(1980,11,28))
结果: 332
千行代码,Bug何处藏。 纵使上线又怎样,朝令改,夕断肠。