CEL Capstone Project: Cracking the Caesar Cipher

We will be using Python to complete this project. We are assuming that you have python installed on your system and have the environmental variables configured. You can use the code below, save it as Caesar.py and execute it in your console. We would be executing a brute force attack to crack the code given to us. There are several methods to go about achieving the same. Feel free to implement your own logic.

The Code

message = 'DPEFWJUB MJWF' #encrypted message

for key in range(len(LETTERS)):
   translated = ''
   for symbol in message:
      if symbol in LETTERS:
         num = LETTERS.find(symbol)
         num = num - key
         if num < 0:
            num = num + len(LETTERS)
         translated = translated + LETTERS[num]
         translated = translated + symbol
   print('Hacking key #%s: %s' % (key, translated))

Make sure you have got the indentation right.

Able to come up with alternative code that fulfills the same purpose?

Submit your code here to unlock a bonus capstone project!