Calculate the turn around time of each Processes Return: list of turn around times. >>> calculate_turnaroundtime([3,3,5,1], 4, [0,3,5,0]) [3, 6, 10, 1] >>> calculate_turnaroundtime([3,3], 2, [0,3]) [3, 6] >>> calculate_turnaroundtime([8,10,1], 3, [1,0,3]) [9, 10, 4]
(
burst_time: list[int], no_of_processes: int, waiting_time: list[int]
)
| 74 | |
| 75 | |
| 76 | def calculate_turnaroundtime( |
| 77 | burst_time: list[int], no_of_processes: int, waiting_time: list[int] |
| 78 | ) -> list[int]: |
| 79 | """ |
| 80 | Calculate the turn around time of each Processes |
| 81 | Return: list of turn around times. |
| 82 | >>> calculate_turnaroundtime([3,3,5,1], 4, [0,3,5,0]) |
| 83 | [3, 6, 10, 1] |
| 84 | >>> calculate_turnaroundtime([3,3], 2, [0,3]) |
| 85 | [3, 6] |
| 86 | >>> calculate_turnaroundtime([8,10,1], 3, [1,0,3]) |
| 87 | [9, 10, 4] |
| 88 | """ |
| 89 | turn_around_time = [0] * no_of_processes |
| 90 | for i in range(no_of_processes): |
| 91 | turn_around_time[i] = burst_time[i] + waiting_time[i] |
| 92 | return turn_around_time |
| 93 | |
| 94 | |
| 95 | def calculate_average_times( |