Calculate the waiting time of each processes. Return: The waiting time for each process. >>> calculate_waiting_time(["A", "B", "C"], [2, 4, 7], [2, 4, 6], 3) [0, 0, 1] >>> calculate_waiting_time(["A", "B", "C"], [3, 6, 11], [3, 5, 7], 3) [0, 1, 4]
(
process_name: list, # noqa: ARG001
turn_around_time: list,
burst_time: list,
no_of_process: int,
)
| 74 | |
| 75 | |
| 76 | def calculate_waiting_time( |
| 77 | process_name: list, # noqa: ARG001 |
| 78 | turn_around_time: list, |
| 79 | burst_time: list, |
| 80 | no_of_process: int, |
| 81 | ) -> list: |
| 82 | """ |
| 83 | Calculate the waiting time of each processes. |
| 84 | |
| 85 | Return: The waiting time for each process. |
| 86 | >>> calculate_waiting_time(["A", "B", "C"], [2, 4, 7], [2, 4, 6], 3) |
| 87 | [0, 0, 1] |
| 88 | >>> calculate_waiting_time(["A", "B", "C"], [3, 6, 11], [3, 5, 7], 3) |
| 89 | [0, 1, 4] |
| 90 | """ |
| 91 | |
| 92 | waiting_time = [0] * no_of_process |
| 93 | for i in range(no_of_process): |
| 94 | waiting_time[i] = turn_around_time[i] - burst_time[i] |
| 95 | return waiting_time |
| 96 | |
| 97 | |
| 98 | if __name__ == "__main__": |
no outgoing calls
no test coverage detected