Skip to content

Commit ad7977a

Browse files
committed
formatting and redundant reasignment fix
1 parent d2c2bba commit ad7977a

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

scheduling/shortest_job_first.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
def calculate_waitingtime(
1212
arrival_time: List[int], burst_time: List[int], no_of_processes: int
1313
) -> List[int]:
14-
1514
"""
1615
Calculate the waiting time of each processes
1716
Return: list of waiting times.
@@ -112,7 +111,8 @@ def calculate_average_times(
112111
for i in range(no_of_processes):
113112
total_waiting_time = total_waiting_time + waiting_time[i]
114113
total_turn_around_time = total_turn_around_time + turn_around_time[i]
115-
print("Average waiting time = %.5f" % (total_waiting_time / no_of_processes))
114+
print("Average waiting time = %.5f" %
115+
(total_waiting_time / no_of_processes))
116116
print("Average turn around time =", total_turn_around_time / no_of_processes)
117117

118118

@@ -126,15 +126,20 @@ def calculate_average_times(
126126
for i in range(no_of_processes):
127127
print("Enter the arrival time and brust time for process:--" + str(i + 1))
128128
arrival_time[i], burst_time[i] = map(int, input().split())
129-
waiting_time = calculate_waitingtime(arrival_time, burst_time, no_of_processes)
129+
130+
waiting_time = calculate_waitingtime(
131+
arrival_time, burst_time, no_of_processes)
132+
130133
bt = burst_time
131134
n = no_of_processes
132135
wt = waiting_time
133136
turn_around_time = calculate_turnaroundtime(bt, n, wt)
137+
134138
calculate_average_times(waiting_time, turn_around_time, no_of_processes)
135-
processes = list(range(1, no_of_processes + 1))
139+
136140
fcfs = pd.DataFrame(
137-
list(zip(processes, burst_time, arrival_time, waiting_time, turn_around_time)),
141+
list(zip(processes, burst_time, arrival_time,
142+
waiting_time, turn_around_time)),
138143
columns=[
139144
"Process",
140145
"BurstTime",

0 commit comments

Comments
 (0)