memoryc = open("cipher.txt", "a")
memoryd = open("decipher.txt", "a")
#-------------------------------------------------------------------------------
choice = input("cipher, decipher or memory")
#-------------------------------------------------------------------------------
if choice == "cipher":
    message = input("What is your message?")
    key = int(input("What is your key?"))
    coded_message = ""
    for ch in message:
        code_val  = ord(ch) + key
        if ch.isalpha():
            if code_val > ord('z'):
                code_val -= ord('z') - ord('a')
            coded_message = coded_message + chr(code_val)
        else:
            coded_message = coded_message + ch
    memoryc.write(coded_message +"\n")
    print(coded_message)
    quit = input("Do you want to quit")
#-------------------------------------------------------------------------------
if choice == "decipher":
    message = input("What is your message?")
    key = int(input("What is your key?"))
    coded_message = ""
    for ch in message:
        code_val  = ord(ch) - key
        if ch.isalpha():
            if code_val > ord('z'):
                code_val -= ord('z') + ord('a')
            coded_message = coded_message + chr(code_val)
        else:
            coded_message = coded_message + ch
    memoryd.write(coded_message +"\n")
    print(coded_message)
    quit = input("Do you want to quit")
#-------------------------------------------------------------------------------
if choice == "memory":
    cd = input("cipher or decipher memory?")
    if cd == "cipher":
        memoryc = open("cipher.txt", "r")
        ciphermemory = memoryc.read()
        print(ciphermemory)
    if cd == "decipher":
        memoryd = open("decipher.txt", "r")
        deciphermemory = memoryd.read()
        print(deciphermemory)
#-------------------------------------------------------------------------------
memoryc.close()
memoryd.close()

when using the decipher part of my program it doesn't work correctly with all letters. Any help appretiated.

Yep, note that I skimmed through your code and didn't run it on my machine. So hopefully my initial thoughts fix your problem.

This question has already been answered. Start a new discussion instead.