This function calculates the turnaround time of some processes. Return: The time difference between the completion time and the arrival time. Practically waiting_time + duration_time >>> calculate_turnaround_times([5, 10, 15], [0, 5, 15]) [5, 15,
(
duration_times: list[int], waiting_times: list[int]
)
| 24 | |
| 25 | |
| 26 | def calculate_turnaround_times( |
| 27 | duration_times: list[int], waiting_times: list[int] |
| 28 | ) -> list[int]: |
| 29 | """ |
| 30 | This function calculates the turnaround time of some processes. |
| 31 | Return: The time difference between the completion time and the |
| 32 | arrival time. |
| 33 | Practically waiting_time + duration_time |
| 34 | >>> calculate_turnaround_times([5, 10, 15], [0, 5, 15]) |
| 35 | [5, 15, 30] |
| 36 | >>> calculate_turnaround_times([1, 2, 3, 4, 5], [0, 1, 3, 6, 10]) |
| 37 | [1, 3, 6, 10, 15] |
| 38 | >>> calculate_turnaround_times([10, 3], [0, 10]) |
| 39 | [10, 13] |
| 40 | """ |
| 41 | return [ |
| 42 | duration_time + waiting_times[i] |
| 43 | for i, duration_time in enumerate(duration_times) |
| 44 | ] |
| 45 | |
| 46 | |
| 47 | def calculate_average_turnaround_time(turnaround_times: list[int]) -> float: |
no outgoing calls
no test coverage detected