Answer to Question #186143 in Python for mani

Question #186143

Secret Message - 1

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


Note: Mirroring the characters in alphabetical order replacing the letters 'a' with 'z', 'b' with 'y', ... , 'z' with 'a'. You need to mirror both uppercase and lowercase characters. You can ignore mirroring for all characters that are not letters.


abcdefghijklm

zyxwvutsrqpon 

nopqrstuvwxyz

mlkjihgfedcba


Input


The input will be a string in the single line containing spaces and letters (both uppercase and lowercase).


Output


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




Sample Input 1

python


Sample Output 1

kbgslm


Sample Input 2

Foundations


Sample Output 2

ulfmwzgrlmh


1
Expert's answer
2021-04-27T05:23:38-0400
str1 = "abcdefghijklmnopqrstuvwxyz"
str1_upp = str1.upper()
str2 = "zyxwvutsrqponmlkjihgfedcba"
str2_upp = str2.upper()
table = "".maketrans(str1+str1_upp, str2+str2_upp)


while True:
   n = input("Enter a string: ")
   if len(n) == 0:
       break 
   print("Traslate: ", n.translate(table))

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