Answer to Question #188140 in Python for Hari nadh babu

Question #188140

Secret Message - 1

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

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.

Explanation

For example, if the 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 the output should be "kbgslm".


Input 1:-

python

Output 1:-

kbgslm


Input 2:-

Foundations

Output 2:-

ulfmwzgrlmh


Input:-3

python learning

Output 3:-

kbgslm ovzimrmt


1
Expert's answer
2021-05-03T14:30:11-0400
s = input()
result = ''
s1 = 'abcdefghijklm'
s2 = 'zyxwvutsrqpon'
for x in s:
    if x.lower() in s1:
        result = result + s2[s1.find(x.lower())]
    elif x.lower() in s2:
        result = result + s1[s2.find(x.lower())]
    else:
        result = result + x.lower()
print(result)

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
APPROVED BY CLIENTS