

'''simple docstring'''

from __future__ import annotations

def     __magic_name__       ( A							)			->		List[str]:
	snake_case							 =				[0] * len(lowercase_							)
	for i in range(1					,   len(lowercase_							)							):
		snake_case							 =				duration_times[i - 1] + waiting_times[i - 1]
	return waiting_times

def     __magic_name__       ( A					,   A							)			->		List[str]:
	return [
	    duration_time + waiting_times[i]
	    for i, duration_time in enumerate(lowercase_							)
	]

def     __magic_name__       ( A							)			->		Tuple:
	return sum(lowercase_							) / len(lowercase_							)

def     __magic_name__       ( A							)			->		Tuple:
	return sum(lowercase_							) / len(lowercase_							)


if __name__ == "__main__":
						# process id's
						lowerCAmelCase_						   =			[1, 2, 3]

						# ensure that we actually have processes
						if len(processes) == 0:
												print("Zero amount of processes")
												raise SystemExit(0)

						# duration time of all processes
						lowerCAmelCase_						   =			[1_9, 8, 9]

						# ensure we can match each id to a duration time
						if len(duration_times) != len(processes):
												print("Unable to match all id\'s with their duration time")
												raise SystemExit(0)

						# get the waiting times and the turnaround times
						lowerCAmelCase_						   =			calculate_waiting_times(duration_times)
						lowerCAmelCase_						   =			calculate_turnaround_times(duration_times, waiting_times)

						# get the average times
						lowerCAmelCase_						   =			calculate_average_waiting_time(waiting_times)
						lowerCAmelCase_						   =			calculate_average_turnaround_time(turnaround_times)

						# print all the results
						print("Process ID\tDuration Time\tWaiting Time\tTurnaround Time")
						for i, process in enumerate(processes):
												print(
												    f"{process}\t\t{duration_times[i]}\t\t{waiting_times[i]}\t\t"
												    f"{turnaround_times[i]}"
												)
						print(f"Average waiting time = {average_waiting_time}")
						print(f"Average turn around time = {average_turnaround_time}")








'''simple docstring'''

lowerCAmelCase_						   =			{0: [1, 2], 1: [0, 3], 2: [0], 3: [1], 4: [5, 6], 5: [4, 6], 6: [4, 5]}

lowerCAmelCase_						   =			{0: [1, 2, 3], 1: [0, 3], 2: [0], 3: [0, 1], 4: [], 5: []}

def     __magic_name__       ( A					,   A					,   A							)			->		list:
	snake_case							 =				True
	snake_case							 =				[]

	for neighbour in graph[vert]:
		if not visited[neighbour]:
			connected_verts += dfs(A					,   A					,   A							)

	return [vert, *connected_verts]

def     __magic_name__       ( A							)			->		list:
	snake_case							 =				len(A							)
	snake_case							 =				graph_size * [False]
	snake_case							 =				[]

	for i in range(A							):
		if not visited[i]:
			snake_case							 =				dfs(A					,   A					,   A							)
			components_list.append(A							)

	return components_list


if __name__ == "__main__":
						import doctest

						doctest.testmod()





