alphabet = "abcdefghijklmnopqrstuvwxyz"
special_ctrs = ".,!'?;: \"&#@$%^*()/\\[]{}=~"
secret_str = ""
msg = input("Enter a secret message:")
print(msg)
def alpha_dec(message):
secret_str = ""
index = 0
message = message.lower()
for character in message:
if character == " ":
secret_str = secret_str + " "
elif character.isalpha() == False:
if character.isdigit() == True:
secret_str += str(int(character) - 1)
else:
index = special_ctrs.find(character) - 1
secret_str += special_ctrs[index]
elif character in alphabet:
index = alphabet.find(character) - 1
secret_str += alphabet[index]
return secret_str
print(alpha_dec(msg))
secret_alphabet = "zabcdefhijklmnopqrstuvwxy"
output_msg = " "
secret_msg = input("Type your secret message: ")
def msg_decode(secret_msg,output_msg):
index = 0
secret_msg = secret_msg.lower()
for character in secret_msg:
if character == " ":
output_msg = output_msg + " "
elif character.isalpha() == False:
if character.isdigit() == True:
output_msg += str(int(character) - 24)
elif character in secret_alphabet:
index = secret_alphabet.find(character) - 24
output_msg += secret_alphabet[index]
return output_msg
print(msg_decode(secret_msg,output_msg))