
'''simple docstring'''





def snake_case_    (				lowercase__      ,					lowercase__		):
  if not isinstance(lowercase__      ,					lowercase__		):
    raise TypeError("plaintext must be a string"		)
  if not isinstance(lowercase__      ,					lowercase__		):
    raise TypeError("key must be a string"		)

  if not plaintext:
    raise ValueError("plaintext is empty"		)
  if not key:
    raise ValueError("key is empty"		)

  key += plaintext
  UpperCAmelCase__			:				int												=       plaintext.lower()
  UpperCAmelCase__			:				List[Any]												=       key.lower()
  UpperCAmelCase__			:				Dict												=       0
  UpperCAmelCase__			:				Union[str, Any]												=       0
  UpperCAmelCase__			:				str												=       ""
  while plaintext_iterator < len(lowercase__		):
    if (
        ord(plaintext[plaintext_iterator]		) < 9_7
        or ord(plaintext[plaintext_iterator]		) > 1_2_2
    ):
      ciphertext += plaintext[plaintext_iterator]
      plaintext_iterator += 1
    elif ord(key[key_iterator]		) < 9_7 or ord(key[key_iterator]		) > 1_2_2:
      key_iterator += 1
    else:
      ciphertext += chr(
          (
              (ord(plaintext[plaintext_iterator]		) - 9_7 + ord(key[key_iterator]		))
              - 9_7
          )
          % 2_6
          + 9_7		)
      key_iterator += 1
      plaintext_iterator += 1
  return ciphertext







def snake_case_    (				lowercase__      ,					lowercase__		):
  if not isinstance(lowercase__      ,					lowercase__		):
    raise TypeError("ciphertext must be a string"		)
  if not isinstance(lowercase__      ,					lowercase__		):
    raise TypeError("key must be a string"		)

  if not ciphertext:
    raise ValueError("ciphertext is empty"		)
  if not key:
    raise ValueError("key is empty"		)

  UpperCAmelCase__			:				List[Any]												=       key.lower()
  UpperCAmelCase__			:				Tuple												=       0
  UpperCAmelCase__			:				int												=       0
  UpperCAmelCase__			:				List[Any]												=       ""
  while ciphertext_iterator < len(lowercase__		):
    if (
        ord(ciphertext[ciphertext_iterator]		) < 9_7
        or ord(ciphertext[ciphertext_iterator]		) > 1_2_2
    ):
      plaintext += ciphertext[ciphertext_iterator]
    else:
      plaintext += chr(
          (ord(ciphertext[ciphertext_iterator]		) - ord(key[key_iterator]		)) % 2_6
          + 9_7		)
      key += chr(
          (ord(ciphertext[ciphertext_iterator]		) - ord(key[key_iterator]		)) % 2_6
          + 9_7		)
      key_iterator += 1
    ciphertext_iterator += 1
  return plaintext


if __name__ == "__main__":
      import doctest

      doctest.testmod()
      SCREAMING_SNAKE_CASE    =					int(input("""Type 1 to encrypt or 2 to decrypt:"""))
      if operation == 1:
            SCREAMING_SNAKE_CASE    =					input("""Typeplaintext to be encrypted:\n""")
            SCREAMING_SNAKE_CASE    =					input("""Type the key:\n""")
            print(encrypt(plaintext, key))
      elif operation == 2:
            SCREAMING_SNAKE_CASE    =					input("""Type the ciphertext to be decrypted:\n""")
            SCREAMING_SNAKE_CASE    =					input("""Type the key:\n""")
            print(decrypt(ciphertext, key))
      decrypt("""jsqqs avvwo""", """coffee""")





'''simple docstring'''





from doctest import testmod
from math import sqrt







def snake_case_    (				lowercase__		):
  UpperCAmelCase__			:				list[int]												=       []
  if num < 1:
    return facs
  facs.append(1		)
  if num == 1:
    return facs
  facs.append(lowercase__		)
  for i in range(2      ,					int(sqrt(lowercase__		)		) + 1		):
    if num % i == 0:  # If i is a factor of num
      facs.append(lowercase__		)
      UpperCAmelCase__			:				Tuple												=       num // i  # num//i is the other factor of num
      if d != i:  # If d and i are distinct
        facs.append(lowercase__		)  # we have found another factor
  facs.sort()
  return facs


if __name__ == "__main__":
      testmod(name="""factors_of_a_number""", verbose=True)



