A harbour office logs how many minutes late the morning ferry left each day (0 means it left on time). Before anyone argues about averages, they want the plain facts.
Write delay_log(minutes, limit) that returns a tuple of four numbers:
- the number of days logged,
- the total number of minutes of delay over all days,
- the number of days the ferry left on time (a delay of
0), - the number of days the delay was at least
limitminutes.
Examples
Input: minutes = [4, 0, 0, 12, 2, 0, 7], limit = 5
Output: (7, 25, 3, 2)
Explanation: 7 days, 4 + 12 + 2 + 7 = 25 minutes in total, three days on time,
and two days (12 and 7) at or over 5 minutes.
Input: minutes = [], limit = 10
Output: (0, 0, 0, 0)
Constraints
0 <= len(minutes) <= 10**5- every delay is a whole number with
0 <= delay <= 600 1 <= limit <= 600
Goals
- Keep several running values in one pass over the data
- Count only the values that meet a condition
- Tell apart how many values there are and how much they add up to