

"""simple docstring"""


def 					a__					(					__SCREAMING_SNAKE_CASE				)			->			int:
		if number != int(__SCREAMING_SNAKE_CASE				):
				raise ValueError("factorial() only accepts integral values"				)
		if number < 0:
				raise ValueError("factorial() not defined for negative values"				)
		__lowerCAmelCase: Union[str, Any]					   =    1
		for i in range(1      ,				number + 1				):
				value *= i
		return value






def 					a__					(					__SCREAMING_SNAKE_CASE				)			->			int:
		if not isinstance(__SCREAMING_SNAKE_CASE      ,				__SCREAMING_SNAKE_CASE				):
				raise ValueError("factorial() only accepts integral values"				)
		if n < 0:
				raise ValueError("factorial() not defined for negative values"				)
		return 1 if n == 0 or n == 1 else n * factorial(n - 1				)


if __name__ == "__main__":
			import doctest

			doctest.testmod()

			__A		     =    int(input("Enter a positive integer: ").strip() or 0)
			print(F'''factorial{n} is {factorial(n)}''')





"""simple docstring"""


import random
import sys

__A		     =    "ABCDEFGHIJKLMNOPQRSTUVWXYZ"






def 					a__					(					)			->			None:
		__lowerCAmelCase: int					   =    input("Enter message: "				)
		__lowerCAmelCase: Any					   =    "LFWOAYUISVKMNXPBDCRJTQEGHZ"
		__lowerCAmelCase: int					   =    input("Encrypt/Decrypt [e/d]: "				)

		check_valid_key(__SCREAMING_SNAKE_CASE				)

		if resp.lower().startswith("e"				):
				__lowerCAmelCase: Tuple					   =    "encrypt"
				__lowerCAmelCase: int					   =    encrypt_message(__SCREAMING_SNAKE_CASE      ,				__SCREAMING_SNAKE_CASE				)
		elif resp.lower().startswith("d"				):
				__lowerCAmelCase: str					   =    "decrypt"
				__lowerCAmelCase: List[str]					   =    decrypt_message(__SCREAMING_SNAKE_CASE      ,				__SCREAMING_SNAKE_CASE				)

		print(F"\n{mode.title()}ion: \n{translated}"				)






def 					a__					(					__SCREAMING_SNAKE_CASE				)			->			None:
		__lowerCAmelCase: List[Any]					   =    list(__SCREAMING_SNAKE_CASE				)
		__lowerCAmelCase: Optional[int]					   =    list(__SCREAMING_SNAKE_CASE				)
		key_list.sort()
		letters_list.sort()

		if key_list != letters_list:
				sys.exit("Error in the key or symbol set."				)






def 					a__					(					__SCREAMING_SNAKE_CASE      ,				__SCREAMING_SNAKE_CASE				)			->			str:
		return translate_message(__SCREAMING_SNAKE_CASE      ,				__SCREAMING_SNAKE_CASE      ,				"encrypt"				)






def 					a__					(					__SCREAMING_SNAKE_CASE      ,				__SCREAMING_SNAKE_CASE				)			->			str:
		return translate_message(__SCREAMING_SNAKE_CASE      ,				__SCREAMING_SNAKE_CASE      ,				"decrypt"				)






def 					a__					(					__SCREAMING_SNAKE_CASE      ,				__SCREAMING_SNAKE_CASE      ,				__SCREAMING_SNAKE_CASE				)			->			str:
		__lowerCAmelCase: Union[str, Any]					   =    ""
		__lowerCAmelCase: List[str]					   =    LETTERS
		__lowerCAmelCase: Optional[int]					   =    key

		if mode == "decrypt":
				__lowerCAmelCase   ,				__lowerCAmelCase: Optional[int]					   =    chars_b, chars_a

		for symbol in message:
				if symbol.upper() in chars_a:
						__lowerCAmelCase: Union[str, Any]					   =    chars_a.find(symbol.upper()				)
						if symbol.isupper():
								translated += chars_b[sym_index].upper()
						else:
								translated += chars_b[sym_index].lower()
				else:
						translated += symbol

		return translated






def 					a__					(					)			->			str:
		__lowerCAmelCase: int					   =    list(__SCREAMING_SNAKE_CASE				)
		random.shuffle(__SCREAMING_SNAKE_CASE				)
		return "".join(__SCREAMING_SNAKE_CASE				)


if __name__ == "__main__":
			main()


