title: Python: Changing values in a String with a for loop
body: <p>I am trying to build a caesar cipher in python, so I am trying to loop through the string and change the characters.</p>
  
  <pre><code>def caesar_shift(s, n):
    letters = list(s)
    for x in letters:
        if x == ' ':
            continue
        x = ord(x)
        x += n
        while (97 &lt; x &lt; 122) != True:
          if x &lt; 97:
            x += 26
          elif x &gt; 122:
            x -= 26
    letters = ''.join(letters)  
    return letters
  print caesar_shift('a',1)
  </code></pre>
  
  <p>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?</p>