<commit_before># The Caesar Cipher Algorithm

def main():
    message = input("Enter message: ")
    key = int(input("Key [1-26]: "))
    mode = input("Encrypt or Decrypt [e/d]: ")

    if mode.lower().startswith('e'):
        mode = "encrypt"
    elif mode.lower().startswith('d'):
        mode = "decrypt"

    translated = encdec(message, key, mode)
    if mode == "encrypt":
        print("Encryption:", translated)
    elif mode == "decrypt":
        print("Decryption:", translated)
        
def encdec(message, key, mode):
    """
    >>> encdec('<NAME>', 12, 'encrypt')
    'TMDETUX PMDVU'

    >>> encdec('TMDETUX PMDVU', 12, 'decrypt')
    '<NAME>'
    """
    message = message.upper()
    translated = ""
    LETTERS = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
    for symbol in message:
        if symbol in LETTERS:
            num = LETTERS.find(symbol)
            if mode == "encrypt":
                num = num + key
            elif mode == "decrypt":
                num = num - key

            if num >= len(LETTERS):
                num = num - len(LETTERS)
            elif num < 0:
                num = num + len(LETTERS)

            translated = translated + LETTERS[num]
        else:
            translated = translated + symbol
    return translated

if __name__ == '__main__':
    import doctest
    doctest.testmod()
    main()<commit_msg>Slight Performance/Visual Update<commit_after># The Caesar Cipher Algorithm

def main():
    message = input("Enter message: ")
    key     = int(input("Key [1-26]: "))
    mode    = input("Encrypt or Decrypt [e/d]: ")

    if mode.lower().startswith('e'):
        mode = "encrypt"
    elif mode.lower().startswith('d'):
        mode = "decrypt"

    translated = encdec(message, key, mode)
    if mode ==   "encrypt":
        print("Encryption:", translated)
    elif mode == "decrypt":
        print("Decryption:", translated)
        
def encdec(message, key, mode):
    message    = message.upper()
    translated = ""
    LETTERS    = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
    for symbol in message:
        if symbol in LETTERS:
            num = LETTERS.find(symbol)
            if mode ==   "encrypt":
                num = num + key
            elif mode == "decrypt":
                num = num - key

            if num >= len(LETTERS):
                num -= len(LETTERS)
            elif num < 0:
                num += len(LETTERS)

            translated += LETTERS[num]
        else:
            translated += symbol
    return translated

if __name__ == '__main__':
    import doctest
    doctest.testmod()
    main()
{'fraction_non_alphanumeric': 0.13124274099883856, 'fraction_numerical': 0.004645760743321719, 'mean_word_length': 1.9164785553047403, 'pattern_counts': {'":': 8, '<': 7, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4591693', 'n_tokens_mistral': 823, 'n_tokens_neox': 775, 'n_words': 205}