
# caesar.py
'''
  A brute force check of how the text would be decoded
  for each possible Caesar cipher.
'''

codedMsg = 'nzohfu gur rarzl ng avtug'

for i in range(26):
  guess = ''
  for ch in codedMsg:
    if ch != ' ':
      # Shift the letter forward by i
      if ord(ch) + i <= 122:
        ch = chr(ord(ch) + i)
      else:  # Subtract 26 if we go beyond z
        ch = chr(ord(ch)+i-26)
    guess = guess + ch
  print(f"{chr(i+65):2s}: {guess}")
