


"""simple docstring"""



import math







def     __lowerCAmelCase		(		lowercase    :    int					)      ->		str:


    """simple docstring"""





    snake_case       : Dict    =       0
    snake_case       : int    =       0
    while num > 0:
        snake_case       : str    =       num % 8
        snake_case       : Dict    =       octal + (remainder * math.floor(math.pow(10		,				lowercase					)					))
        counter += 1
        snake_case       : Optional[int]    =       math.floor(num / 8					)  # basically /= 8 without remainder if any
        # This formatting removes trailing '.0' from `octal`.
    return F'0o{int(lowercase					)}'







def     __lowerCAmelCase		(		)      ->		None:


    """simple docstring"""





    print("\n2 in octal is:"					)
    print(decimal_to_octal(2					)					)  # = 2
    print("\n8 in octal is:"					)
    print(decimal_to_octal(8					)					)  # = 10
    print("\n65 in octal is:"					)
    print(decimal_to_octal(65					)					)  # = 101
    print("\n216 in octal is:"					)
    print(decimal_to_octal(216					)					)  # = 330
    print("\n512 in octal is:"					)
    print(decimal_to_octal(512					)					)  # = 1000
    print("\n"					)


if __name__ == "__main__":
  main()









"""simple docstring"""



__snake_case       =       """ABCDEFGHIJKLMNOPQRSTUVWXYZ"""







def     __lowerCAmelCase		(		)      ->		None:


    """simple docstring"""





    snake_case       : str    =       input("Enter message: "					)
    snake_case       : Tuple    =       input("Enter key [alphanumeric]: "					)
    snake_case       : Union[str, Any]    =       input("Encrypt/Decrypt [e/d]: "					)

    if mode.lower().startswith("e"					):
        snake_case       : str    =       "encrypt"
        snake_case       : Optional[int]    =       encrypt_message(lowercase		,				lowercase					)
    elif mode.lower().startswith("d"					):
        snake_case       : List[Any]    =       "decrypt"
        snake_case       : Tuple    =       decrypt_message(lowercase		,				lowercase					)

    print(F'\n{mode.title()}ed message:'					)
    print(lowercase					)







def     __lowerCAmelCase		(		lowercase    :    str		,				lowercase    :    str					)      ->		str:


    """simple docstring"""





    return translate_message(lowercase		,				lowercase		,				"encrypt"					)







def     __lowerCAmelCase		(		lowercase    :    str		,				lowercase    :    str					)      ->		str:


    """simple docstring"""





    return translate_message(lowercase		,				lowercase		,				"decrypt"					)







def     __lowerCAmelCase		(		lowercase    :    str		,				lowercase    :    str		,				lowercase    :    str					)      ->		str:


    """simple docstring"""





    snake_case       : List[Any]    =       []
    snake_case       : List[str]    =       0
    snake_case       : List[Any]    =       key.upper()

    for symbol in message:
        snake_case       : Optional[int]    =       LETTERS.find(symbol.upper()					)
        if num != -1:
            if mode == "encrypt":
                num += LETTERS.find(key[key_index]					)
            elif mode == "decrypt":
                num -= LETTERS.find(key[key_index]					)

            num %= len(lowercase					)

            if symbol.isupper():
                translated.append(LETTERS[num]					)
            elif symbol.islower():
                translated.append(LETTERS[num].lower()					)

            key_index += 1
            if key_index == len(lowercase					):
                snake_case       : List[str]    =       0
        else:
            translated.append(lowercase					)
    return "".join(lowercase					)


if __name__ == "__main__":
  main()





