class

posted Mar 22, 2016, 7:38 AM by Attila Lengyel   [ updated Mar 22, 2016, 7:53 AM ]
abc = "abcdefghijklmnopqrstuvwxyz"

def encoding(cChar):
    i = -1
    for x in range(0, len(abc)):
        if abc[x] == cChar:
            i = x
            break
    
    if i == -1:
        return cChar
    
    return abc[i - 2]


text = input("Give me a message to encode:")

sMsg = ""
for x in range (0, len(text)):
    sMsg = sMsg + encoding(text[x])
    
print(sMsg)
Comments