77
88def calculate_waiting_times (duration_times : list [int ]) -> list [int ]:
99 """
10- This function calculates the waiting time of some processes that have a
11- specified duration time.
10+ This function calculates the waiting time of some processes that have a specified duration time.
1211 Return: The waiting time for each process.
12+
1313 >>> calculate_waiting_times([5, 10, 15])
1414 [0, 5, 15]
1515 >>> calculate_waiting_times([1, 2, 3, 4, 5])
@@ -31,6 +31,7 @@ def calculate_turnaround_times(
3131 Return: The time difference between the completion time and the
3232 arrival time.
3333 Practically waiting_time + duration_time
34+
3435 >>> calculate_turnaround_times([5, 10, 15], [0, 5, 15])
3536 [5, 15, 30]
3637 >>> calculate_turnaround_times([1, 2, 3, 4, 5], [0, 1, 3, 6, 10])
@@ -48,6 +49,7 @@ def calculate_average_turnaround_time(turnaround_times: list[int]) -> float:
4849 """
4950 This function calculates the average of the turnaround times
5051 Return: The average of the turnaround times.
52+
5153 >>> calculate_average_turnaround_time([0, 5, 16])
5254 7.0
5355 >>> calculate_average_turnaround_time([1, 5, 8, 12])
@@ -62,6 +64,7 @@ def calculate_average_waiting_time(waiting_times: list[int]) -> float:
6264 """
6365 This function calculates the average of the waiting times
6466 Return: The average of the waiting times.
67+
6568 >>> calculate_average_waiting_time([0, 5, 16])
6669 7.0
6770 >>> calculate_average_waiting_time([1, 5, 8, 12])
0 commit comments