I been trying to create a Caesar cypher program with the message 'my secret' and key 6 - all letters are shifted 6 positions to the right in the cypher alphabet, with letters “wrapping around” when falling off the end. Using the cypher, the message “my secret” would be encoded as “gsumzxlzn”. However, I keep the wrong encoded and decoded results. It's comes out as: Encoded: sdfykixkz Decoded: abcdefghi
please help!
import sys
ALPHABET= ['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z',' ']
def main(plaintext, key):
     cypher = generate_cypher(key)
     plaintext = sys.argv[1]
     e_code = encode_message(plaintext, cypher)
     mes s= decode_message(e_code, cypher)
def generate_cypher(key):
    cipher = []
    for i in range(len(ALPHABET)):
        cipher.append(ALPHABET[i+key%27])
    print(cipher)
    return(cipher)
def encode_message(plaintext,cipher):     
    key = int(sys.argv[2])
    en_code=''
    for c in plaintext:
        if c in cipher:
            en_code+=cipher[(cipher.index(c)+key)%(len(cipher))]
    print("Encoded: ", en_code)
    return en_code
def decode_message(e_code,cipher):
    key = int(sys.argv[2])
    message = []
    for i in range(len(e_code)):
        message.append(cipher[i-key%27])
    mess=''.join(message)
    print("Decoded: ", mess)
    return mess
