Created
December 20, 2015 18:19
-
-
Save zyuiop/200923954aa59641dd8a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
word = input("Expression > ") | |
step = int(input("Decallage > ")) | |
word = word[::-1] # Reverse letters order | |
def decryptLetter(letter, key): | |
pos = ord(letter) | |
upBound, downBound = 0, 0 | |
if pos >= 97 and pos <= 122: | |
upBound = 122 | |
downBound = 97 | |
elif pos >= 65 and pos <= 90: | |
upBound = 90 | |
downBound = 65 | |
else: | |
return letter | |
pos += key | |
if pos > upBound: | |
pos -= 26 | |
if pos < downBound: | |
pos += 26 | |
return chr(pos) | |
print(''.join([decryptLetter(char, step) for char in word])) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment