title: Creating a Caesar Cipher using for loops and if/else statements
body: <p>I have to create a Caesar cipher for my class. The stipulations are that I can't import anything, and that I have to use for loops and if/else statements. I've gotten the code pretty close to completion, but am currently stuck. The program currently runs without throwing any error codes, but does not output the required answers. I've attached the code below. There are currently two issues that I'm seeking solutions for. Firstly, I wrote a if/else statement to wrap around the values if they are below 65 or above 96. This is all that's necessary as the output should be in all caps. However, this statement doesn't seem to be doing anything. I'm not currently sure why this is. Secondly, the code adds a character to the output after each space. I've told the code to basically ignore spaces, so I have no idea why this is. For example: If my message was &quot;Attack zerg at dawn&quot; and my encoding key was &quot;3&quot;, the output should be &quot;DWWDFN CHUJ DW GDZQ&quot;, just capitalizing everything and shifting them by 3. However, I get &quot;DWWDFN =]HUJ =DW =GDZQ&quot;. As you can see, it's mostly correct. I just can't seem to figure out the parts that aren't. Thanks for any assistance you're able to provide.</p>
  <pre><code>enter def caesar_cipher():
  text = str.upper(input(&quot;Your message? &quot;))
  shift = int(input(&quot;Encoding key? &quot;))
  for i in range(0, len(text)):
      a = text[i]
      o = a.find(&quot; &quot;)
      if o == 0:
          print(&quot; &quot;, end='')
      p = a.find(&quot;'&quot;)
      if p == 0:
          print(&quot;'&quot;, end='')
      s = a.find(&quot;!&quot;)
      if s == 0:
          print(&quot;!&quot;, end='')
      d = a.find('&quot;')
      if d == 0:
          print('&quot;', end='')
      new = ord(str(a)) + shift
      if int(new) &gt;= 97:
          new2 = int(new) - 26
          new3 = chr(int(new2))
      elif int(new) &lt;= 64:
          new2 = int(new) + 26
          new3 = chr(int(new2))
      else:
          new3 = chr(int(new))
      print(new3, end='')
  
  
  caesar_cipher()
  </code></pre>