


import os
import sys
import time

from . import transposition_cipher as trans_cipher
def     UpperCamelCase_(			)->						Optional[int]:
			UpperCamelCase__   =    'Prehistoric Men.txt'
			UpperCamelCase__   =    'Output.txt'
			UpperCamelCase__   =    int(input("Enter key: "					)					)
			UpperCamelCase__   =    input("Encrypt/Decrypt [e/d]: "					)

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

			UpperCamelCase__   =    time.time()
			if mode.lower().startswith("e"					):
						with open(SCREAMING_SNAKE_CASE__					) as f:
									UpperCamelCase__   =    f.read()
						UpperCamelCase__   =    trans_cipher.encrypt_message(SCREAMING_SNAKE_CASE__			,       SCREAMING_SNAKE_CASE__					)
			elif mode.lower().startswith("d"					):
						with open(SCREAMING_SNAKE_CASE__					) as f:
									UpperCamelCase__   =    f.read()
						UpperCamelCase__   =    trans_cipher.decrypt_message(SCREAMING_SNAKE_CASE__			,       SCREAMING_SNAKE_CASE__					)

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

			UpperCamelCase__   =    round(time.time() - start_time			,       2					)
			print(("Done (", total_time, "seconds )")					)


if __name__ == "__main__":
						main()






from __future__ import annotations
def     UpperCamelCase_(			_A				:list					)->						int | float:
			UpperCamelCase__   =    sorted(_A					)
			UpperCamelCase__   =    len(_A					)
			UpperCamelCase__   =    length >> 1
			return (
			    (sorted_list[mid_index] + sorted_list[mid_index - 1]) / 2
			    if length % 2 == 0
			    else sorted_list[mid_index]
			)
def     UpperCamelCase_(			)->						List[Any]:
			import doctest

			doctest.testmod()


if __name__ == "__main__":
						main()


