title: Caesar Cipher algorithm with strings and for loop Python
body: <p>The assignment is to write a Caesar Cipher algorithm that receives 2 parameters, the first being a String parameter, the second telling how far to shift the alphabet. The first part is to set up a method and set up two strings, one normal and one shifted. I have done this. Then I need to make a loop to iterate through the original string to build a new string, by finding the original letters and selecting the appropriate new letter from the shifted string. I've spent at least two hours staring at this one, and talked to my teacher so I know I'm doing some things right. But as for what goes in the while loop, I really don't have a clue. Any hints or pushes in the right direction would be very helpful so I at least have somewhere to start would be great, thank you.</p>
  
  <pre><code>def cipher(x, dist):
      alphabet = "abcdefghijklmnopqrstuvwxyz"
      shifted = "xyzabcdefghijklmnopqrstuvw"
      stringspot = 0
      shiftspot = (x.find("a"))
      aspot = (x.find("a"))
      while stringspot &lt; 26:
          aspot = shifted(dist)
          shifted = 
          stringspot = stringspot + 1
          ans = 
      return ans
  
  print(cipher("abcdef", 1))
  print(cipher("abcdef", 2))
  print(cipher("abcdef", 3))
  print(cipher("dogcatpig", 1))
  </code></pre>