




"""simple docstring"""




from typing import Literal

UpperCamelCase            =   'ABCDEFGHIJKLMNOPQRSTUVWXYZ'







def       __UpperCAmelCase      (				__UpperCamelCase					,							__UpperCamelCase					,							__UpperCamelCase					):
			__lowercase	:       Optional[int]				=   LETTERS if mode == '''decrypt''' else key
			__lowercase	:       Optional[Any]				=   key if mode == '''decrypt''' else LETTERS
			__lowercase	:       List[str]				=   ''''''
			# loop through each symbol in the message
			for symbol in message:
						if symbol.upper() in chars_a:
									# encrypt/decrypt the symbol
									__lowercase	:       List[Any]				=   chars_a.find(symbol.upper()					)
									if symbol.isupper():
												translated += chars_b[sym_index].upper()
									else:
												translated += chars_b[sym_index].lower()
						else:
									# symbol is not in LETTERS, just add it
									translated += symbol
			return translated







def       __UpperCAmelCase      (				__UpperCamelCase					,							__UpperCamelCase					):
			return translate_message(__UpperCamelCase					,							__UpperCamelCase					,							'''encrypt'''					)







def       __UpperCAmelCase      (				__UpperCamelCase					,							__UpperCamelCase					):
			return translate_message(__UpperCamelCase					,							__UpperCamelCase					,							'''decrypt'''					)







def       __UpperCAmelCase      (				):
			__lowercase	:       int				=   '''Hello World'''
			__lowercase	:       List[Any]				=   '''QWERTYUIOPASDFGHJKLZXCVBNM'''
			__lowercase	:       Union[str, Any]				=   '''decrypt'''  # set to 'encrypt' or 'decrypt'

			if mode == "encrypt":
						__lowercase	:       Tuple				=   encrypt_message(__UpperCamelCase					,							__UpperCamelCase					)
			elif mode == "decrypt":
						__lowercase	:       List[str]				=   decrypt_message(__UpperCamelCase					,							__UpperCamelCase					)
			print(f"""Using the key {key}, the {mode}ed message is: {translated}"""					)


if __name__ == "__main__":
			import doctest

			doctest.testmod()
			main()









"""simple docstring"""




from __future__ import annotations







def       __UpperCAmelCase      (				__UpperCamelCase					):
			__lowercase	:       List[Any]				=   [0] * len(__UpperCamelCase					)
			for i in range(1					,							len(__UpperCamelCase					)					):
						__lowercase	:       Optional[Any]				=   duration_times[i - 1] + waiting_times[i - 1]
			return waiting_times







def       __UpperCAmelCase      (				__UpperCamelCase					,							__UpperCamelCase					):
			return [
			    duration_time + waiting_times[i]
			    for i, duration_time in enumerate(__UpperCamelCase					)
			]







def       __UpperCAmelCase      (				__UpperCamelCase					):
			return sum(__UpperCamelCase					) / len(__UpperCamelCase					)







def       __UpperCAmelCase      (				__UpperCamelCase					):
			return sum(__UpperCamelCase					) / len(__UpperCamelCase					)


if __name__ == "__main__":
			# process id's
			a_            =   [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
			a_            =   [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
			a_            =   calculate_waiting_times(duration_times)
			a_            =   calculate_turnaround_times(duration_times, waiting_times)

			# get the average times
			a_            =   calculate_average_waiting_time(waiting_times)
			a_            =   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}")



