Python/ciphers/Atbash.py
cclauss 0f229e0870 Atbash.py: Both raw_input() and unichr() were removed in Python 3 (#855)
* Atbash.py: Both raw_input() and unichr() were removed in Python 3

@sateslayer and @AnupKumarPanwar your reviews please.

* Remove any leading / trailing whitespace from user input
2019-06-05 09:09:04 +08:00

22 lines
466 B
Python
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

try: # Python 2
raw_input
unichr
except NameError: # Python 3
raw_input = input
unichr = chr
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)
else:
output+=i
print(output)
Atbash()