Monday, 8 June 2020

47 Encryption: Caesar

#Caesar code

#L1 = ['a','e'] # + swap 'find' for 'index'
L1 = 'aeiou'
print (' introdu')
MESS = input ()

for LETTER in MESS:
    NEWPOS = L1.find(LETTER)+1 #find the position in L1, +1
    if NEWPOS == 0 :
        print ('\nthe letter ' + LETTER+ ' is not included so i stop')
        break #quit() if you want to kill it
    elif NEWPOS >= len(L1):
        NEWPOS = 0    #solving last item +1 error
    #print (L1.find(LETTER))  #Finds the position of the item in a list
    print (L1[NEWPOS], end = '') #cancels the default print-newline