Created
July 22, 2020 08:09
-
-
Save KatUser/a27bfec6ababe19e6a2d7fe74c904746 to your computer and use it in GitHub Desktop.
Ceaser_decoder
This file contains hidden or 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
en_alphabet = [x for x in range(ord('a'), ord('z') + 1)] | |
s = input() | |
whitespace = 'whitespace' | |
s = s.replace(' ', ' whitespace') | |
s = s.split(whitespace) | |
for word in s: | |
counter = 0 | |
for symbol in word: | |
if ord(symbol.lower()) in en_alphabet: | |
counter = counter + 1 | |
for symbol in word: | |
if ord(symbol.lower()) in en_alphabet: | |
if ord(symbol.lower()) + counter in en_alphabet: | |
if symbol == symbol.upper() in word: | |
print(chr(ord(symbol.lower()) + counter).upper(), end='') | |
else: | |
print(chr(ord(symbol.lower()) + counter), end='') | |
else: | |
if symbol == symbol.upper() in word: | |
print(chr(ord(symbol.lower()) + counter - len(en_alphabet)).upper(), end='') | |
else: | |
print(chr(ord(symbol.lower()) + counter - len(en_alphabet)), end='') | |
else: | |
print(symbol, end='') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment