I am trying to build a caesar cipher in python, so I am trying to loop through the string and change the characters.
def caesar_shift(s, n):
letters = list(s)
for x in letters:
if x == ' ':
continue
x = ord(x)
x += n
while (97 < x < 122) != True:
if x < 97:
x += 26
elif x > 122:
x -= 26
letters = ''.join(letters)
return letters
print caesar_shift('a',1)
My output shows that x changes to 98, then turns into a 'b', but when the actual string is printed, all it shows is the letter 'a'. Any help?