

'''simple docstring'''





from __future__ import annotations

from statistics import mean






def  UpperCamelCase_(							_snake_case     :						list[int]			):




			"""simple docstring"""






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






def  UpperCamelCase_(							_snake_case     :						list[int] ,  _snake_case     :						list[int]			):




			"""simple docstring"""






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


if __name__ == "__main__":
						_lowerCAmelCase      :    str						       =    [3, 5, 7]
						_lowerCAmelCase      :    int						       =    calculate_waiting_times(burst_times)
						_lowerCAmelCase      :    Union[str, Any]						       =    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}''')









import os
import sys
import time

from . import transposition_cipher as trans_cipher






def  UpperCamelCase_(							):




			"""simple docstring"""






			__a						   ='Prehistoric Men.txt'
			__a						   ='Output.txt'
			__a						   =int(input('Enter key: '			)			)
			__a						   =input('Encrypt/Decrypt [e/d]: '			)

			if not os.path.exists(_snake_case			):
						print(F'File {input_file} does not exist. Quitting...'			)
						sys.exit()
			if os.path.exists(_snake_case			):
						print(F'Overwrite {output_file}? [y/n]'			)
						__a						   =input('> '			)
						if not response.lower().startswith('y'			):
									sys.exit()

			__a						   =time.time()
			if mode.lower().startswith('e'			):
						with open(_snake_case			) as f:
									__a						   =f.read()
						__a						   =trans_cipher.encrypt_message(_snake_case ,  _snake_case			)
			elif mode.lower().startswith('d'			):
						with open(_snake_case			) as f:
									__a						   =f.read()
						__a						   =trans_cipher.decrypt_message(_snake_case ,  _snake_case			)

			with open(_snake_case ,  'w'			) as output_obj:
						output_obj.write(_snake_case			)

			__a						   =round(time.time() - start_time ,  2			)
			print(('Done (', total_time, 'seconds )')			)


if __name__ == "__main__":
						main()






