Python/ciphers/atbash.py

24 lines
498 B
Python
Raw Normal View History

try: # Python 2
raw_input
unichr
except NameError: # Python 3
raw_input = input
unichr = chr
2019-05-26 16:40:04 +00:00
def Atbash():
output=""
for i in raw_input("Enter the sentence to be encrypted ").strip():
extract = ord(i)
if 65 <= extract <= 90:
output += unichr(155-extract)
elif 97 <= extract <= 122:
output += unichr(219-extract)
2019-05-26 16:40:04 +00:00
else:
output+=i
print(output)
2019-05-26 16:40:04 +00:00
if __name__ == '__main__':
Atbash()