Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 16 additions & 9 deletions ciphers/Atbash.py
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,21 @@
try: # Python 2
raw_input
unichr
except NameError: # Python 3
raw_input = input
unichr = chr


def Atbash():
inp=raw_input("Enter the sentence to be encrypted ")
output=""
for i in inp:
extract=ord(i)
if extract>=65 and extract<=90:
output+=(unichr(155-extract))
elif extract>=97 and extract<=122:
output+=(unichr(219-extract))
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)
print(output)

Atbash() ;
Atbash()