Вы перекодируете свою зашифрованную букву в каждом цикле, это бы сработало:
for c in phrase:
ascii_codes = ord(c) # find ascii codes for each charcter in phrase
ascii_codes = ascii_codes + shift_value # add an integer (shift value) to ascii codes
phrase_rest = chr(ascii_codes) # convert ascii codes back to characters
encoded_phrase = encoded_phrase + phrase_rest # stores the phrase character in a new variable
однако вы можете настроить словарь с исходной буквой и зашифрованной.Затем вы перебираете их и получаете зашифрованное предложение.Например:
cypher = {'a': 'x', 'b': 'y', ... }
encoded = ''
for c in phrase:
encoded += cypher[c]