Your question is Average Task Time Calculation. Start with the requirements on the right.
Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.
The Noom app stores a baseline daily assignment schedule and temporary assignment overrides. Write a function that returns the arithmetic average assignment value for every calendar day in an inclusive date range.
A baseline interval and a temporary assignment contain start, end, and numeric value fields. Dates use the YYYY-MM-DD format. Baseline intervals are non-overlapping and cover every requested day. Temporary assignments are non-overlapping, and override the baseline on their covered dates. The range may contain days with no temporary assignment.
Implement average_assignment(baseline, temporary_assignments, start_date, end_date), where baseline and temporary_assignments are lists of dictionaries and each date interval is inclusive. Return a floating-point number equal to the sum of the effective daily values divided by the number of days in the requested range. Do not iterate over every date in the range.
def average_assignment(baseline, temporary_assignments, start_date, end_date):