Pycharm - Console


Advertisements

PyCharm has a full-fledged Python console with full code completion which is available in the option menu Tools -> Run Python Console.

Run Console

Consider the code which was mentioned in the previous chapter, as shown below −

message = 'GIEWIVrGMTLIVrHIQS' #encrypted message
LETTERS = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
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]
      else:
         translated = translated + symbol
   print('Hacking key #%s: %s' % (key, translated))

Now, let us run the code with the help of console to execute the script for getting the desired output, as shown below.

Desired Output

You can observe the output as shown below −

Final Output
Advertisements