Every Monday

Data with PythonEasy+10 XP+10

Every Monday

A café's till exports the number of coffees sold each day as one long list. It always holds whole weeks, and every week starts on Monday: Monday, Tuesday, and so on up to Sunday, then the next Monday.

The manager wants to compare the same day across weeks, such as every Monday.

Task: write weekday_values(daily, weekday). weekday is a number for the day: 0 is Monday, 1 is Tuesday, and so on up to 6 for Sunday. Return that day's count from every week, as a plain list, in week order.

The list always holds at least one whole week, and its length is always a multiple of 7.

Examples

daily = [12, 15, 14, 18, 25, 40, 33, 10, 16, 13, 19, 27, 44, 30]
weekday = 0
returns [12, 10]
daily = [12, 15, 14, 18, 25, 40, 33, 10, 16, 13, 19, 27, 44, 30]
weekday = 5
returns [40, 44]

Hints

Solve it to unlock the solution

Once your code passes every test, a reference solution shows up here so you can compare it with yours.

solution.py
CtrlEnterto run