Ad
Code
Diff
  • def days(month, day):
       days_since_month = [0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334]
       return days_since_month[month - 1] + day
    • from datetime import datetime
    • def count_days(since: datetime, to: datetime) -> int:
    • return (to - since).days + 1
    • def days(month: int, day: int) -> int:
    • since = datetime(day=1, month=1, year=2022)
    • to = datetime(day=day, month=month, year=2022)
    • return count_days(since, to)
    • def days(month, day):
    • days_since_month = [0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334]
    • return days_since_month[month - 1] + day