Ad
Code
Diff
  • def days(month,day):
        return[0,31,59,90,120,151,181,212,243,273,304,334][month-1]+day
    • def days(months, day):
    • month_by_days = [0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334]
    • return month_by_days[int(months) - 1] + int(day)
    • def days(month,day):
    • return[0,31,59,90,120,151,181,212,243,273,304,334][month-1]+day
Code
Diff
  • def days(month,day):
        return sum([31,28,31,30,31,30,31,31,30,31,30,31][:month-1])+day
    • def days(months, day):
    • month_by_days = [False,
    • 0 +day, 31 +day, 59 +day,
    • 90 +day, 120 +day, 151 +day,
    • 181 +day, 212 +day, 243 +day,
    • 273 +day, 304 +day, 334 +day ]
    • return month_by_days[int(months)]
    • def days(month,day):
    • return sum([31,28,31,30,31,30,31,31,30,31,30,31][:month-1])+day