Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- message = 'AVNYY'
- LETTERS = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
- for key in range(len(LETTERS)):
- translated = ''
- for symbol in message:
- if symbol in LETTERS:
- num = LETTERS.find(symbol) # get the number of the symbol
- num = num - key
- # handle the wrap-around if num is 26 or larger or less than 0
- if num < 0:
- num = num + len(LETTERS)
- # add number's symbol at the end of translated
- translated = translated + LETTERS[num]
- else:
- # just add the symbol without encrypting/decrypting
- translated = translated + symbol
- print('Key #%s: %s' % (key, translated))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement