Caesar Cipher

Caesar Cipher: The Caesar cipher is one of the earliest known and simplest ciphers. It is a type of substitution cipher in which each letter in the plaintext is ‘shifted’ a certain number of places down the alphabet. For example, with a shift of 1, A would be replaced by B, B would become C, and so on. The method is named after Julius Caesar, who apparently used it to communicate with his generals.

alphabet = ' abcdefghijklmnopqrstuvwxyz '
def encoder(mgs,key):
    sour = ''
    for i in mgs:
        sour+=alphabet[alphabet.find(i)+key]
    return sour
def decoder(mgs,key):
    sour = ''
    for i in mgs:
        sour+=alphabet[alphabet.find(i)-key]
    return sour
print(encoder('hello my name is caesar',1))
ifmmpanzaobnfajtadbftbs
print(decoder('ifmmpanzaobnfajtadbftbs',1))
hello my name is caesar