Simplify code by dropping support for legacy Python (#1143)

* Simplify code by dropping support for legacy Python

* sort() --> sorted()
This commit is contained in:
Christian Clauss
2019-08-19 15:37:49 +02:00
committed by GitHub
parent 32aa7ff081
commit 47a9ea2b0b
145 changed files with 367 additions and 976 deletions

View File

@ -1,23 +1,15 @@
try: # Python 2
raw_input
unichr
except NameError: # Python 3
raw_input = input
unichr = chr
def Atbash():
def atbash():
output=""
for i in raw_input("Enter the sentence to be encrypted ").strip():
for i in input("Enter the sentence to be encrypted ").strip():
extract = ord(i)
if 65 <= extract <= 90:
output += unichr(155-extract)
output += chr(155-extract)
elif 97 <= extract <= 122:
output += unichr(219-extract)
output += chr(219-extract)
else:
output+=i
output += i
print(output)
if __name__ == '__main__':
Atbash()
atbash()