Weekly Calendar Weekly Calendar
Simple
RU English

Let's make a weekly calendar.

You are given four integers as input values. (A year, month, day and the first day of the week [0: Monday...6: Sunday])
You must return a list (or an iterable) of the week that includes the date in the input values.
This begins with the first day of the week.

Example:

list(weekly_calendar(2020, 1, 1, 0)) == [30, 31, 1, 2, 3, 4, 5]
list(weekly_calendar(2020, 9, 20, 6)) == [20, 21, 22, 23, 24, 25, 26]
list(weekly_calendar(2020, 9, 30, 0)) == [28, 29, 30, 1, 2, 3, 4]

Input: Four integers (a year, month, day and the first day of the week).

Output: A list (or an iterable) of seven integers.

Precondition:

  • datetime.date(1, 1, 1) ≤ datetime.date(year, month, day) ≤ datetime.date(9999, 12, 31)
  • 0 ≤ the first day of the week ≤ 6