






from __future__ import annotations
def       a__						(  A					):
   lowercase__						:	str         = [0] * len(A					)
   for i in range(1		,				len(A					)					):
      lowercase__						:	Tuple         = duration_times[i - 1] + waiting_times[i - 1]
   return waiting_times
def       a__						(  A		,				A					):
   return [
       duration_time + waiting_times[i]
       for i, duration_time in enumerate(A					)
   ]
def       a__						(  A					):
   return sum(A					) / len(A					)
def       a__						(  A					):
   return sum(A					) / len(A					)


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    =       [19, 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}')










import os
import sys
import time

from . import transposition_cipher as trans_cipher
def       a__						(  ):
   lowercase__						:	Union[str, Any]         = """Prehistoric Men.txt"""
   lowercase__						:	Optional[Any]         = """Output.txt"""
   lowercase__						:	List[str]         = int(input("""Enter key: """					)					)
   lowercase__						:	Tuple         = input("""Encrypt/Decrypt [e/d]: """					)

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

   lowercase__						:	str         = time.time()
   if mode.lower().startswith("""e"""					):
      with open(A					) as f:
         lowercase__						:	Optional[int]         = f.read()
      lowercase__						:	List[str]         = trans_cipher.encrypt_message(A		,				A					)
   elif mode.lower().startswith("""d"""					):
      with open(A					) as f:
         lowercase__						:	int         = f.read()
      lowercase__						:	int         = trans_cipher.decrypt_message(A		,				A					)

   with open(A		,				"""w"""					) as output_obj:
      output_obj.write(A					)

   lowercase__						:	Optional[Any]         = round(time.time() - start_time		,				2					)
   print(("""Done (""", total_time, """seconds )""")					)


if __name__ == "__main__":
 main()


