Answer to Question #186318 in Python for hemanth

Question #186318

Secret Message - 1

Given a string, write a program to mirror characters of string in alphabetical order to create a secret message.




a b c d e f g h i j k l m

z y x w v u t s r q p o n 


n o p q r s t u v w x y z

m l k j i h g f e d c b a


Input


Input will be a string in the single line containing spaces and letters both uppercase and lowercase.


Output


Output should be a single line containing secret message. All characters in the output should be in lower case.


Explanation


For example, if given input is "python", "p" should replaced with "k", similarly "y" with "b", "t" with "g", "h" with "s", "o" with "l", "n" with "m". So output be "kbgslm".


Sample Input 1

python


Sample Output 1

kbgslm


Sample Input 2

Foundations


Sample Output 2

ulfmwzgrlmh


1
Expert's answer
2021-04-27T13:15:21-0400
alphabet="abcdefghijklmnopqrstuvwxyz"
alpha_upper=alphabet.upper()

secret_key="zyxwvutsrqponmlkjihgfedcba"
secret_upper=secret_key.upper()

table="".maketrans(alphabet+alpha_upper, secret_key+secret_upper)

myString=input("Enter the source string: ")
print("Secret message: ",myString.translate(table).lower())
 

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS