




from __future__ import annotations

from statistics import mean


def 				__SCREAMING_SNAKE_CASE    (     snake_case_		):

						'''simple docstring'''


						_UpperCAmelCase						=	2
						_UpperCAmelCase						=	list(snake_case_		)
						_UpperCAmelCase						=	[0] * len(snake_case_		)
						_UpperCAmelCase						=	0
						while True:
												_UpperCAmelCase						=	True
												for i, burst_time in enumerate(snake_case_		):
																		if rem_burst_times[i] > 0:
																								_UpperCAmelCase						=	False
																								if rem_burst_times[i] > quantum:
																														t += quantum
																														rem_burst_times[i] -= quantum
																								else:
																														t += rem_burst_times[i]
																														_UpperCAmelCase						=	t - burst_time
																														_UpperCAmelCase						=	0
												if done is True:
																		return waiting_times


def 				__SCREAMING_SNAKE_CASE    (     snake_case_      ,       snake_case_		):

						'''simple docstring'''


						return [burst + waiting for burst, waiting in zip(snake_case_      ,       snake_case_		)]


if __name__ == "__main__":
				lowercase_      :							int    							=					[3, 5, 7]
				lowercase_      :							Any    							=					calculate_waiting_times(burst_times)
				lowercase_      :							Dict    							=					calculate_turn_around_times(burst_times, waiting_times)
				print('Process ID \tBurst Time \tWaiting Time \tTurnaround Time')
				for i, burst_time in enumerate(burst_times):
								print(
								    f"""  {i + 1}\t\t  {burst_time}\t\t  {waiting_times[i]}\t\t  """
								    f"""{turn_around_times[i]}"""
								)
				print(f"""\nAverage waiting time = {mean(waiting_times):.5f}""")
				print(f"""Average turn around time = {mean(turn_around_times):.5f}""")










def 				__SCREAMING_SNAKE_CASE    (     snake_case_		):

						'''simple docstring'''


						return int(snake_case_		) if x - int(snake_case_		) >= 0 else int(snake_case_		) - 1


if __name__ == "__main__":
				import doctest

				doctest.testmod()




